Fix flag legend for watchlist from r54336 breakage
authorAryeh Gregor <simetrical@users.mediawiki.org>
Tue, 4 Aug 2009 10:59:35 +0000 (10:59 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Tue, 4 Aug 2009 10:59:35 +0000 (10:59 +0000)
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
includes/specials/SpecialRecentchanges.php
includes/specials/SpecialWatchlist.php

index f2433c2..ac1da7c 100644 (file)
@@ -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 '<div class="mw-rc-label-legend">' .
+                       wfMsgWikiHtml( 'recentchanges-label-legend', $wgLang->commaList( $flags ) )
+                       . '</div>';
+       }
+
        /**
         * Returns text for the start of the tabular part of RC
         * @return string
index 2f3473a..c78abd0 100644 (file)
@@ -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( '<div class="mw-rc-label-legend">' );
-               $wgOut->addWikiMsg( 'recentchanges-label-legend',
-                       $wgLang->commaList( $flags ) );
-               $wgOut->addHTML( '</div>' );
+               $wgOut->addHTML( ChangesList::flagLegend() );
 
                $this->setBottomText( $wgOut, $opts );
        }
index 3d37b62..97fd8d1 100644 (file)
@@ -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 ) {