From 258450346e0bbbb1ac99f7251269fc11b49352d7 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Tue, 4 Aug 2009 10:59:35 +0000 Subject: [PATCH] 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. --- includes/ChangesList.php | 30 +++++++++++++++++++++- includes/specials/SpecialRecentchanges.php | 22 ++-------------- includes/specials/SpecialWatchlist.php | 4 +-- 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/includes/ChangesList.php b/includes/ChangesList.php index f2433c2876..ac1da7cdbd 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -131,11 +131,39 @@ class ChangesList { * @param $key string 'newpage', 'unpatrolled', 'minor', or 'bot' * @return string Raw HTML */ - public static function flagLegend( $key ) { + private static function flagLine( $key ) { return wfMsgExt( "recentchanges-legend-$key", array( 'escapenoentities', 'replaceafter' ), self::flag( $key ) ); } + /** + * A handy legend to tell users what the little "m", "b", and so on mean. + * + * @return string Raw HTML + */ + public static function flagLegend() { + global $wgGroupPermissions, $wgLang; + + $flags = array( self::flagLine( 'newpage' ), + self::flagLine( 'minor' ) ); + + # Don't show info on bot edits unless there's a bot group of some kind + foreach ( $wgGroupPermissions as $rights ) { + if ( isset( $rights['bot'] ) && $rights['bot'] ) { + $flags[] = self::flagLine( 'bot' ); + break; + } + } + + if ( self::usePatrol() ) { + $flags[] = self::flagLine( 'unpatrolled' ); + } + + return '
' . + wfMsgWikiHtml( 'recentchanges-label-legend', $wgLang->commaList( $flags ) ) + . '
'; + } + /** * Returns text for the start of the tabular part of RC * @return string diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index 2f3473ae0a..c78abd0528 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -408,7 +408,7 @@ class SpecialRecentChanges extends SpecialPage { * @return String: XHTML */ public function doHeader( $opts ) { - global $wgScript, $wgOut, $wgLang, $wgUser, $wgGroupPermissions; + global $wgScript, $wgOut; $this->setTopText( $wgOut, $opts ); @@ -457,25 +457,7 @@ class SpecialRecentChanges extends SpecialPage { Xml::fieldset( wfMsg( 'recentchanges-legend' ), $panelString, array( 'class' => 'rcoptions' ) ) ); - $flags = array( ChangesList::flagLegend( 'newpage' ), - ChangesList::flagLegend( 'minor' ) ); - - # Don't show info on bot edits unless there's a bot group of some kind - foreach ( $wgGroupPermissions as $rights ) { - if ( isset( $rights['bot'] ) && $rights['bot'] ) { - $flags[] = ChangesList::flagLegend( 'bot' ); - break; - } - } - - if ( $wgUser->useRCPatrol() ) { - $flags[] = ChangesList::flagLegend( 'unpatrolled' ); - } - - $wgOut->addHTML( '
' ); - $wgOut->addWikiMsg( 'recentchanges-label-legend', - $wgLang->commaList( $flags ) ); - $wgOut->addHTML( '
' ); + $wgOut->addHTML( ChangesList::flagLegend() ); $this->setBottomText( $wgOut, $opts ); } diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index 3d37b625b4..97fd8d166a 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -290,9 +290,7 @@ function wfSpecialWatchlist( $par ) { $form .= Xml::closeElement( 'fieldset' ); $wgOut->addHTML( $form ); - $wgOut->addWikiMsg( 'recentchanges-label-legend', - ChangesList::flag( 'newpage' ), ChangesList::flag( 'minor' ), - ChangesList::flag( 'bot' ), ChangesList::flag( 'unpatrolled' ) ); + $wgOut->addHTML( ChangesList::flagLegend() ); # If there's nothing to show, stop here if( $numRows == 0 ) { -- 2.20.1