r54355 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r54354‎ | r54355 | r54356 >
Date:10:59, 4 August 2009
Author:simetrical
Status:ok (Comments)
Tags:
Comment:
Fix flag legend for watchlist from r54336 breakage

Mistake pointed out by Darth Kule on translatewiki.net, conveyed to me
by Nikerabbit. I changed the semantics of a message but didn't update
all the callers.
Modified paths:
  • /trunk/phase3/includes/ChangesList.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialRecentchanges.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialWatchlist.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ChangesList.php
@@ -131,12 +131,40 @@
132132 * @param $key string 'newpage', 'unpatrolled', 'minor', or 'bot'
133133 * @return string Raw HTML
134134 */
135 - public static function flagLegend( $key ) {
 135+ private static function flagLine( $key ) {
136136 return wfMsgExt( "recentchanges-legend-$key", array( 'escapenoentities',
137137 'replaceafter' ), self::flag( $key ) );
138138 }
139139
140140 /**
 141+ * A handy legend to tell users what the little "m", "b", and so on mean.
 142+ *
 143+ * @return string Raw HTML
 144+ */
 145+ public static function flagLegend() {
 146+ global $wgGroupPermissions, $wgLang;
 147+
 148+ $flags = array( self::flagLine( 'newpage' ),
 149+ self::flagLine( 'minor' ) );
 150+
 151+ # Don't show info on bot edits unless there's a bot group of some kind
 152+ foreach ( $wgGroupPermissions as $rights ) {
 153+ if ( isset( $rights['bot'] ) && $rights['bot'] ) {
 154+ $flags[] = self::flagLine( 'bot' );
 155+ break;
 156+ }
 157+ }
 158+
 159+ if ( self::usePatrol() ) {
 160+ $flags[] = self::flagLine( 'unpatrolled' );
 161+ }
 162+
 163+ return '<div class="mw-rc-label-legend">' .
 164+ wfMsgWikiHtml( 'recentchanges-label-legend', $wgLang->commaList( $flags ) )
 165+ . '</div>';
 166+ }
 167+
 168+ /**
141169 * Returns text for the start of the tabular part of RC
142170 * @return string
143171 */
Index: trunk/phase3/includes/specials/SpecialRecentchanges.php
@@ -408,7 +408,7 @@
409409 * @return String: XHTML
410410 */
411411 public function doHeader( $opts ) {
412 - global $wgScript, $wgOut, $wgLang, $wgUser, $wgGroupPermissions;
 412+ global $wgScript, $wgOut;
413413
414414 $this->setTopText( $wgOut, $opts );
415415
@@ -457,26 +457,8 @@
458458 Xml::fieldset( wfMsg( 'recentchanges-legend' ), $panelString, array( 'class' => 'rcoptions' ) )
459459 );
460460
461 - $flags = array( ChangesList::flagLegend( 'newpage' ),
462 - ChangesList::flagLegend( 'minor' ) );
 461+ $wgOut->addHTML( ChangesList::flagLegend() );
463462
464 - # Don't show info on bot edits unless there's a bot group of some kind
465 - foreach ( $wgGroupPermissions as $rights ) {
466 - if ( isset( $rights['bot'] ) && $rights['bot'] ) {
467 - $flags[] = ChangesList::flagLegend( 'bot' );
468 - break;
469 - }
470 - }
471 -
472 - if ( $wgUser->useRCPatrol() ) {
473 - $flags[] = ChangesList::flagLegend( 'unpatrolled' );
474 - }
475 -
476 - $wgOut->addHTML( '<div class="mw-rc-label-legend">' );
477 - $wgOut->addWikiMsg( 'recentchanges-label-legend',
478 - $wgLang->commaList( $flags ) );
479 - $wgOut->addHTML( '</div>' );
480 -
481463 $this->setBottomText( $wgOut, $opts );
482464 }
483465
Index: trunk/phase3/includes/specials/SpecialWatchlist.php
@@ -290,9 +290,7 @@
291291 $form .= Xml::closeElement( 'fieldset' );
292292 $wgOut->addHTML( $form );
293293
294 - $wgOut->addWikiMsg( 'recentchanges-label-legend',
295 - ChangesList::flag( 'newpage' ), ChangesList::flag( 'minor' ),
296 - ChangesList::flag( 'bot' ), ChangesList::flag( 'unpatrolled' ) );
 294+ $wgOut->addHTML( ChangesList::flagLegend() );
297295
298296 # If there's nothing to show, stop here
299297 if( $numRows == 0 ) {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r54336Only show useful info in RC legend...simetrical00:48, 4 August 2009

Comments

#Comment by Brion VIBBER (talk | contribs)   22:35, 4 August 2009

flagging fixme for the funky-looking legend

#Comment by Werdna (talk | contribs)   17:03, 27 August 2009

Giving this thing a shot.

Status & tagging log