[MediaWiki-commits] [Gerrit] When aborting EnhancedRC block line, block should reflect that - change (mediawiki/core)

2015-09-16 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: When aborting EnhancedRC block line, block should reflect that
..


When aborting EnhancedRC block line, block should reflect that

It was possible to abort the rendering of all block lines, but
the block would still be rendered (with nothing inside). It
would also render a "x changes" link, even though that "x" is
no longer correct.

This had been reverted in adba11dfe332c4c10dbbf0f817982d4a225de6b1,
but has now been fixed up.

Change-Id: Ic5d15e56bc2f46fa6aa8c9375f3cafeb13e1ea9c
---
M includes/changes/EnhancedChangesList.php
1 file changed, 135 insertions(+), 104 deletions(-)

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



diff --git a/includes/changes/EnhancedChangesList.php 
b/includes/changes/EnhancedChangesList.php
index 9635c17..1a02a97 100644
--- a/includes/changes/EnhancedChangesList.php
+++ b/includes/changes/EnhancedChangesList.php
@@ -270,6 +270,20 @@
 
$queryParams['curid'] = $curId;
 
+   # Sub-entries
+   $lines = '';
+   foreach ( $block as $i => $rcObj ) {
+   $line = $this->getLineData( $block, $rcObj, 
$queryParams );
+   $lines .= $line;
+   if ( !$line ) {
+   // completely ignore this RC entry if we don't 
want to render it
+   unset( $block[$i] );
+   }
+   }
+   // Further down are some assumptions that $block is a 0-indexed 
array
+   // with (count-1) as last key. Let's make sure it is.
+   $block = array_values( $block );
+
$r .= $this->getLogText( $block, $queryParams, $allLogs, 
$isnew, $namehidden );
 
$r .= ' . . ';
@@ -299,111 +313,12 @@
$r .= $this->numberofWatchingusers( 
$block[0]->numberofWatchingusers );
$r .= '';
 
-   # Sub-entries
-   foreach ( $block as $rcObj ) {
-   # Classes to apply -- TODO implement
-   $classes = array();
-   $type = $rcObj->mAttribs['rc_type'];
-   $data = array();
-
-   $trClass = $rcObj->watched && 
$rcObj->mAttribs['rc_timestamp'] >= $rcObj->watched
-   ? ' class="mw-enhanced-watched"' : '';
-   $separator = ' . 
. ';
-
-   $data['recentChangesFlags'] = array(
-   'newpage' => $type == RC_NEW,
-   'minor' => $rcObj->mAttribs['rc_minor'],
-   'unpatrolled' => $rcObj->unpatrolled,
-   'bot' => $rcObj->mAttribs['rc_bot'],
-   );
-
-   $params = $queryParams;
-
-   if ( $rcObj->mAttribs['rc_this_oldid'] != 0 ) {
-   $params['oldid'] = 
$rcObj->mAttribs['rc_this_oldid'];
-   }
-
-   # Log timestamp
-   if ( $type == RC_LOG ) {
-   $link = $rcObj->timestamp;
-   # Revision link
-   } elseif ( !ChangesList::userCan( $rcObj, 
Revision::DELETED_TEXT, $this->getUser() ) ) {
-   $link = '' . 
$rcObj->timestamp . ' ';
-   } else {
-   $link = Linker::linkKnown(
-   $rcObj->getTitle(),
-   $rcObj->timestamp,
-   array(),
-   $params
-   );
-   if ( $this->isDeleted( $rcObj, 
Revision::DELETED_TEXT ) ) {
-   $link = '' . $link . ' ';
-   }
-   }
-   $data['timestampLink'] = $link;
-
-   $currentAndLastLinks = '';
-   if ( !$type == RC_LOG || $type == RC_NEW ) {
-   $currentAndLastLinks .= ' ' . $this->msg( 
'parentheses' )->rawParams(
-   $rcObj->curlink .
-   
$this->message['pipe-separator'] .
-   $rcObj->lastlink
-   )->escaped();
-   }
-   $data['currentAndLastLinks'] = $currentAndLastLinks;
-   $data['separatorAfterCurrentAndLastLinks'] = $separator;
-
-   # Character diff
-   if ( $RCShowChangedSize ) {
-   $cd = $this->formatCharacterDifference( $rcObj 
);
-   

[MediaWiki-commits] [Gerrit] When aborting EnhancedRC block line, block should reflect that - change (mediawiki/core)

2015-09-16 Thread Matthias Mullie (Code Review)
Matthias Mullie has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/238713

Change subject: When aborting EnhancedRC block line, block should reflect that
..

When aborting EnhancedRC block line, block should reflect that

It was possible to abort the rendering of all block lines, but
the block would still be rendered (with nothing inside). It
would also render a "x changes" link, even though that "x" is
no longer correct.

This had been reverted in adba11dfe332c4c10dbbf0f817982d4a225de6b1.

Change-Id: Ic5d15e56bc2f46fa6aa8c9375f3cafeb13e1ea9c
---
M includes/changes/EnhancedChangesList.php
1 file changed, 132 insertions(+), 104 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/13/238713/1

diff --git a/includes/changes/EnhancedChangesList.php 
b/includes/changes/EnhancedChangesList.php
index 9635c17..21dc359 100644
--- a/includes/changes/EnhancedChangesList.php
+++ b/includes/changes/EnhancedChangesList.php
@@ -270,6 +270,17 @@
 
$queryParams['curid'] = $curId;
 
+   # Sub-entries
+   $lines = '';
+   foreach ( $block as $i => $rcObj ) {
+   $line = $this->getLineData( $block, $rcObj, 
$queryParams );
+   $lines .= $line;
+   if ( !$line ) {
+   // completely ignore this RC entry if we don't 
want to render it
+   unset( $block[$i] );
+   }
+   }
+
$r .= $this->getLogText( $block, $queryParams, $allLogs, 
$isnew, $namehidden );
 
$r .= ' . . ';
@@ -299,111 +310,12 @@
$r .= $this->numberofWatchingusers( 
$block[0]->numberofWatchingusers );
$r .= '';
 
-   # Sub-entries
-   foreach ( $block as $rcObj ) {
-   # Classes to apply -- TODO implement
-   $classes = array();
-   $type = $rcObj->mAttribs['rc_type'];
-   $data = array();
-
-   $trClass = $rcObj->watched && 
$rcObj->mAttribs['rc_timestamp'] >= $rcObj->watched
-   ? ' class="mw-enhanced-watched"' : '';
-   $separator = ' . 
. ';
-
-   $data['recentChangesFlags'] = array(
-   'newpage' => $type == RC_NEW,
-   'minor' => $rcObj->mAttribs['rc_minor'],
-   'unpatrolled' => $rcObj->unpatrolled,
-   'bot' => $rcObj->mAttribs['rc_bot'],
-   );
-
-   $params = $queryParams;
-
-   if ( $rcObj->mAttribs['rc_this_oldid'] != 0 ) {
-   $params['oldid'] = 
$rcObj->mAttribs['rc_this_oldid'];
-   }
-
-   # Log timestamp
-   if ( $type == RC_LOG ) {
-   $link = $rcObj->timestamp;
-   # Revision link
-   } elseif ( !ChangesList::userCan( $rcObj, 
Revision::DELETED_TEXT, $this->getUser() ) ) {
-   $link = '' . 
$rcObj->timestamp . ' ';
-   } else {
-   $link = Linker::linkKnown(
-   $rcObj->getTitle(),
-   $rcObj->timestamp,
-   array(),
-   $params
-   );
-   if ( $this->isDeleted( $rcObj, 
Revision::DELETED_TEXT ) ) {
-   $link = '' . $link . ' ';
-   }
-   }
-   $data['timestampLink'] = $link;
-
-   $currentAndLastLinks = '';
-   if ( !$type == RC_LOG || $type == RC_NEW ) {
-   $currentAndLastLinks .= ' ' . $this->msg( 
'parentheses' )->rawParams(
-   $rcObj->curlink .
-   
$this->message['pipe-separator'] .
-   $rcObj->lastlink
-   )->escaped();
-   }
-   $data['currentAndLastLinks'] = $currentAndLastLinks;
-   $data['separatorAfterCurrentAndLastLinks'] = $separator;
-
-   # Character diff
-   if ( $RCShowChangedSize ) {
-   $cd = $this->formatCharacterDifference( $rcObj 
);
-   if ( $cd !== '' ) {
-   $data['characterDiff'] = $cd;
-   

[MediaWiki-commits] [Gerrit] When aborting EnhancedRC block line, block should reflect that - change (mediawiki/core)

2015-09-09 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: When aborting EnhancedRC block line, block should reflect that
..


When aborting EnhancedRC block line, block should reflect that

It was possible to abort the rendering of all block lines, but
the block would still be rendered (with nothing inside). It
would also render a "x changes" link, even though that "x" is
no longer correct.

Change-Id: I94ae68e80461dcfbf328683522ea6cb58c6c5753
---
M includes/changes/EnhancedChangesList.php
1 file changed, 132 insertions(+), 104 deletions(-)

Approvals:
  Sbisson: Looks good to me, but someone else must approve
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/changes/EnhancedChangesList.php 
b/includes/changes/EnhancedChangesList.php
index 9635c17..21dc359 100644
--- a/includes/changes/EnhancedChangesList.php
+++ b/includes/changes/EnhancedChangesList.php
@@ -270,6 +270,17 @@
 
$queryParams['curid'] = $curId;
 
+   # Sub-entries
+   $lines = '';
+   foreach ( $block as $i => $rcObj ) {
+   $line = $this->getLineData( $block, $rcObj, 
$queryParams );
+   $lines .= $line;
+   if ( !$line ) {
+   // completely ignore this RC entry if we don't 
want to render it
+   unset( $block[$i] );
+   }
+   }
+
$r .= $this->getLogText( $block, $queryParams, $allLogs, 
$isnew, $namehidden );
 
$r .= ' . . ';
@@ -299,111 +310,12 @@
$r .= $this->numberofWatchingusers( 
$block[0]->numberofWatchingusers );
$r .= '';
 
-   # Sub-entries
-   foreach ( $block as $rcObj ) {
-   # Classes to apply -- TODO implement
-   $classes = array();
-   $type = $rcObj->mAttribs['rc_type'];
-   $data = array();
-
-   $trClass = $rcObj->watched && 
$rcObj->mAttribs['rc_timestamp'] >= $rcObj->watched
-   ? ' class="mw-enhanced-watched"' : '';
-   $separator = ' . 
. ';
-
-   $data['recentChangesFlags'] = array(
-   'newpage' => $type == RC_NEW,
-   'minor' => $rcObj->mAttribs['rc_minor'],
-   'unpatrolled' => $rcObj->unpatrolled,
-   'bot' => $rcObj->mAttribs['rc_bot'],
-   );
-
-   $params = $queryParams;
-
-   if ( $rcObj->mAttribs['rc_this_oldid'] != 0 ) {
-   $params['oldid'] = 
$rcObj->mAttribs['rc_this_oldid'];
-   }
-
-   # Log timestamp
-   if ( $type == RC_LOG ) {
-   $link = $rcObj->timestamp;
-   # Revision link
-   } elseif ( !ChangesList::userCan( $rcObj, 
Revision::DELETED_TEXT, $this->getUser() ) ) {
-   $link = '' . 
$rcObj->timestamp . ' ';
-   } else {
-   $link = Linker::linkKnown(
-   $rcObj->getTitle(),
-   $rcObj->timestamp,
-   array(),
-   $params
-   );
-   if ( $this->isDeleted( $rcObj, 
Revision::DELETED_TEXT ) ) {
-   $link = '' . $link . ' ';
-   }
-   }
-   $data['timestampLink'] = $link;
-
-   $currentAndLastLinks = '';
-   if ( !$type == RC_LOG || $type == RC_NEW ) {
-   $currentAndLastLinks .= ' ' . $this->msg( 
'parentheses' )->rawParams(
-   $rcObj->curlink .
-   
$this->message['pipe-separator'] .
-   $rcObj->lastlink
-   )->escaped();
-   }
-   $data['currentAndLastLinks'] = $currentAndLastLinks;
-   $data['separatorAfterCurrentAndLastLinks'] = $separator;
-
-   # Character diff
-   if ( $RCShowChangedSize ) {
-   $cd = $this->formatCharacterDifference( $rcObj 
);
-   if ( $cd !== '' ) {
-   $data['characterDiff'] = $cd;
-   $data['separatorAfterCharacterDiff'] = 
$separator;
-   

[MediaWiki-commits] [Gerrit] When aborting EnhancedRC block line, block should reflect that - change (mediawiki/core)

2015-07-08 Thread Matthias Mullie (Code Review)
Matthias Mullie has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/223557

Change subject: When aborting EnhancedRC block line, block should reflect that
..

When aborting EnhancedRC block line, block should reflect that

It was possible to abort the rendering of all block lines, but
the block would still be rendered (with nothing inside). It
would also render a x changes link, even though that x is
no longer correct.

Change-Id: I94ae68e80461dcfbf328683522ea6cb58c6c5753
---
M includes/changes/EnhancedChangesList.php
1 file changed, 133 insertions(+), 107 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/57/223557/1

diff --git a/includes/changes/EnhancedChangesList.php 
b/includes/changes/EnhancedChangesList.php
index 9635c17..e4cd042 100644
--- a/includes/changes/EnhancedChangesList.php
+++ b/includes/changes/EnhancedChangesList.php
@@ -270,7 +270,15 @@
 
$queryParams['curid'] = $curId;
 
-   $r .= $this-getLogText( $block, $queryParams, $allLogs, 
$isnew, $namehidden );
+   # Sub-entries
+   $lines = array();
+   foreach ( $block as $rcObj ) {
+   $lines[] = $this-getLineData( $block, $rcObj, 
$queryParams );
+   }
+   #  strip empty (aborted by hook) lines
+   $lines = array_filter( $lines );
+
+   $r .= $this-getLogText( $block, $queryParams, $allLogs, 
$isnew, $namehidden, $lines );
 
$r .= ' span class=mw-changeslist-separator. ./span ';
 
@@ -299,116 +307,133 @@
$r .= $this-numberofWatchingusers( 
$block[0]-numberofWatchingusers );
$r .= '/td/tr';
 
-   # Sub-entries
-   foreach ( $block as $rcObj ) {
-   # Classes to apply -- TODO implement
-   $classes = array();
-   $type = $rcObj-mAttribs['rc_type'];
-   $data = array();
-
-   $trClass = $rcObj-watched  
$rcObj-mAttribs['rc_timestamp'] = $rcObj-watched
-   ? ' class=mw-enhanced-watched' : '';
-   $separator = ' span class=mw-changeslist-separator. 
./span ';
-
-   $data['recentChangesFlags'] = array(
-   'newpage' = $type == RC_NEW,
-   'minor' = $rcObj-mAttribs['rc_minor'],
-   'unpatrolled' = $rcObj-unpatrolled,
-   'bot' = $rcObj-mAttribs['rc_bot'],
-   );
-
-   $params = $queryParams;
-
-   if ( $rcObj-mAttribs['rc_this_oldid'] != 0 ) {
-   $params['oldid'] = 
$rcObj-mAttribs['rc_this_oldid'];
-   }
-
-   # Log timestamp
-   if ( $type == RC_LOG ) {
-   $link = $rcObj-timestamp;
-   # Revision link
-   } elseif ( !ChangesList::userCan( $rcObj, 
Revision::DELETED_TEXT, $this-getUser() ) ) {
-   $link = 'span class=history-deleted' . 
$rcObj-timestamp . '/span ';
-   } else {
-   $link = Linker::linkKnown(
-   $rcObj-getTitle(),
-   $rcObj-timestamp,
-   array(),
-   $params
-   );
-   if ( $this-isDeleted( $rcObj, 
Revision::DELETED_TEXT ) ) {
-   $link = 'span 
class=history-deleted' . $link . '/span ';
-   }
-   }
-   $data['timestampLink'] = $link;
-
-   $currentAndLastLinks = '';
-   if ( !$type == RC_LOG || $type == RC_NEW ) {
-   $currentAndLastLinks .= ' ' . $this-msg( 
'parentheses' )-rawParams(
-   $rcObj-curlink .
-   
$this-message['pipe-separator'] .
-   $rcObj-lastlink
-   )-escaped();
-   }
-   $data['currentAndLastLinks'] = $currentAndLastLinks;
-   $data['separatorAfterCurrentAndLastLinks'] = $separator;
-
-   # Character diff
-   if ( $RCShowChangedSize ) {
-   $cd = $this-formatCharacterDifference( $rcObj 
);
-   if ( $cd !== '' ) {
-   $data['characterDiff'] = $cd;
-