Awight has uploaded a new change for review.

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

Change subject: Clean up recentChangesFlags rollups
......................................................................

Clean up recentChangesFlags rollups

TODO: I wanted to generalize the rc flag rollup so that extension flags can be
included in the group-level flags.  (see Ic49a355a2a4)

Change-Id: I5dd91ba5e5ed36785d9fbf01673defcd227c8b01
---
M includes/changes/EnhancedChangesList.php
1 file changed, 18 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/47/247247/1

diff --git a/includes/changes/EnhancedChangesList.php 
b/includes/changes/EnhancedChangesList.php
index e5916bd..5a4c8bc 100644
--- a/includes/changes/EnhancedChangesList.php
+++ b/includes/changes/EnhancedChangesList.php
@@ -177,18 +177,24 @@
                # Collate list of users
                $userlinks = array();
                # Other properties
-               $unpatrolled = false;
-               $isnew = false;
-               $allBots = true;
-               $allMinors = true;
                $curId = 0;
                # Some catalyst variables...
                $namehidden = true;
                $allLogs = true;
                $RCShowChangedSize = $this->getConfig()->get( 
'RCShowChangedSize' );
+               $collectedRcFlags = array(
+                       // All are by bots?
+                       'bot' => true,
+                       // Begins with a new page?
+                       'newpage' => false,
+                       // All are minor edits?
+                       'minor' => true,
+                       // Contains an unpatrolled edit?
+                       'unpatrolled' => false,
+               );
                foreach ( $block as $rcObj ) {
                        if ( $rcObj->mAttribs['rc_type'] == RC_NEW ) {
-                               $isnew = true;
+                               $collectedRcFlags['newpage'] = true;
                        }
                        // If all log actions to this page were hidden, then 
don't
                        // give the name of the affected page for this block!
@@ -200,7 +206,7 @@
                                $userlinks[$u] = 0;
                        }
                        if ( $rcObj->unpatrolled ) {
-                               $unpatrolled = true;
+                               $collectedRcFlags['unpatrolled'] = true;
                        }
                        if ( $rcObj->mAttribs['rc_type'] != RC_LOG ) {
                                $allLogs = false;
@@ -212,10 +218,10 @@
                        }
 
                        if ( !$rcObj->mAttribs['rc_bot'] ) {
-                               $allBots = false;
+                               $collectedRcFlags['bot'] = false;
                        }
                        if ( !$rcObj->mAttribs['rc_minor'] ) {
-                               $allMinors = false;
+                               $collectedRcFlags['minor'] = false;
                        }
 
                        $userlinks[$u]++;
@@ -246,12 +252,9 @@
                $r .= "<td>$tl</td>";
 
                # Main line
-               $r .= '<td class="mw-enhanced-rc">' . 
$this->recentChangesFlags( array(
-                       'newpage' => $isnew, # show, when one have this flag
-                       'minor' => $allMinors, # show only, when all have this 
flag
-                       'unpatrolled' => $unpatrolled, # show, when one have 
this flag
-                       'bot' => $allBots, # show only, when all have this flag
-               ) );
+               $r .= '<td class="mw-enhanced-rc">' . $this->recentChangesFlags(
+                       $collectedRcFlags
+               );
 
                # Timestamp
                $r .= '&#160;' . $block[0]->timestamp . '&#160;</td><td>';
@@ -270,7 +273,7 @@
 
                $queryParams['curid'] = $curId;
 
-               $r .= $this->getLogText( $block, $queryParams, $allLogs, 
$isnew, $namehidden );
+               $r .= $this->getLogText( $block, $queryParams, $allLogs, 
$collectedRcFlags['newpage'], $namehidden );
 
                $r .= ' <span class="mw-changeslist-separator">. .</span> ';
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5dd91ba5e5ed36785d9fbf01673defcd227c8b01
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Awight <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to