[MediaWiki-commits] [Gerrit] mediawiki...CollaborationKit[master]: Allowing empty columns to have labels and descriptions

2017-01-26 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/334494 )

Change subject: Allowing empty columns to have labels and descriptions
..


Allowing empty columns to have labels and descriptions

Bug: T155661
Change-Id: I1b5171d97b290552215272db3e72e1f1dfa93df0
---
M includes/content/CollaborationListContent.php
1 file changed, 12 insertions(+), 8 deletions(-)

Approvals:
  Harej: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/content/CollaborationListContent.php 
b/includes/content/CollaborationListContent.php
index 12253d6..cdfea78 100644
--- a/includes/content/CollaborationListContent.php
+++ b/includes/content/CollaborationListContent.php
@@ -734,12 +734,12 @@
}
 
private static function convertFromHumanEditableColumn( $column ) {
+   // Adding newline so that HUMAN_COLUMN_SPLIT2 correctly triggers
+   $column = $column . "\n";
+
$columnItem = [ 'items' => [] ];
 
$columnContent = explode( self::HUMAN_COLUMN_SPLIT2, $column );
-   if ( count( $columnContent ) == 1 ) {
-   return $columnItem;
-   }
 
$parts = explode( "|", $columnContent[0] );
 
@@ -775,11 +775,15 @@
}
}
 
-   $listLines = explode( "\n", $columnContent[1] );
-   foreach ( $listLines as $line ) {
-   // Skip empty lines
-   if ( trim( $line ) !== '' ) {
-   $columnItem['items'][] = 
self::convertFromHumanEditableItemLine( $line );
+   if ( count( $columnContent ) == 1 ) {
+   return $columnItem;
+   } else {
+   $listLines = explode( "\n", $columnContent[1] );
+   foreach ( $listLines as $line ) {
+   // Skip empty lines
+   if ( trim( $line ) !== '' ) {
+   $columnItem['items'][] = 
self::convertFromHumanEditableItemLine( $line );
+   }
}
}
 

-- 
To view, visit https://gerrit.wikimedia.org/r/334494
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1b5171d97b290552215272db3e72e1f1dfa93df0
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/CollaborationKit
Gerrit-Branch: master
Gerrit-Owner: Harej 
Gerrit-Reviewer: Harej 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...CollaborationKit[master]: Allowing empty columns to have labels and descriptions

2017-01-26 Thread Harej (Code Review)
Harej has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/334494 )

Change subject: Allowing empty columns to have labels and descriptions
..

Allowing empty columns to have labels and descriptions

Bug: T155661
Change-Id: I1b5171d97b290552215272db3e72e1f1dfa93df0
---
M includes/content/CollaborationListContent.php
1 file changed, 12 insertions(+), 8 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CollaborationKit 
refs/changes/94/334494/1

diff --git a/includes/content/CollaborationListContent.php 
b/includes/content/CollaborationListContent.php
index 12253d6..cdfea78 100644
--- a/includes/content/CollaborationListContent.php
+++ b/includes/content/CollaborationListContent.php
@@ -734,12 +734,12 @@
}
 
private static function convertFromHumanEditableColumn( $column ) {
+   // Adding newline so that HUMAN_COLUMN_SPLIT2 correctly triggers
+   $column = $column . "\n";
+
$columnItem = [ 'items' => [] ];
 
$columnContent = explode( self::HUMAN_COLUMN_SPLIT2, $column );
-   if ( count( $columnContent ) == 1 ) {
-   return $columnItem;
-   }
 
$parts = explode( "|", $columnContent[0] );
 
@@ -775,11 +775,15 @@
}
}
 
-   $listLines = explode( "\n", $columnContent[1] );
-   foreach ( $listLines as $line ) {
-   // Skip empty lines
-   if ( trim( $line ) !== '' ) {
-   $columnItem['items'][] = 
self::convertFromHumanEditableItemLine( $line );
+   if ( count( $columnContent ) == 1 ) {
+   return $columnItem;
+   } else {
+   $listLines = explode( "\n", $columnContent[1] );
+   foreach ( $listLines as $line ) {
+   // Skip empty lines
+   if ( trim( $line ) !== '' ) {
+   $columnItem['items'][] = 
self::convertFromHumanEditableItemLine( $line );
+   }
}
}
 

-- 
To view, visit https://gerrit.wikimedia.org/r/334494
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1b5171d97b290552215272db3e72e1f1dfa93df0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CollaborationKit
Gerrit-Branch: master
Gerrit-Owner: Harej 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits