r54336 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r54335‎ | r54336 | r54337 >
Date:00:48, 4 August 2009
Author:simetrical
Status:ok (Comments)
Tags:
Comment:
Only show useful info in RC legend

This splits up the message recentchanges-label-legend so that pieces of
it can be provided only when they're relevant, and more can be added
later. Any existing translations will need to be retranslated, but it's
only been a day, so creating a new message name seemed like overkill.

Follow-up to r54242.
Modified paths:
  • /trunk/phase3/includes/ChangesList.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialRecentchanges.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1964,10 +1964,14 @@
19651965 'recentchanges-legend' => 'Recent changes options',
19661966 'recentchangestext' => 'Track the most recent changes to the wiki on this page.',
19671967 'recentchanges-feed-description' => 'Track the most recent changes to the wiki in this feed.',
1968 -'recentchanges-label-legend' => 'Legend: $1 - new page, $2 - minor edit, $3 - bot edit, $4 - unpatrolled edit.',
 1968+'recentchanges-label-legend' => 'Legend: $1.',
 1969+'recentchanges-legend-newpage' => '$1 - new page',
19691970 'recentchanges-label-newpage' => 'This edit created a new page',
 1971+'recentchanges-legend-minor' => '$1 - minor edit',
19701972 'recentchanges-label-minor' => 'This is a minor edit',
 1973+'recentchanges-legend-bot' => '$1 - bot edit',
19711974 'recentchanges-label-bot' => 'This edit was performed by a bot',
 1975+'recentchanges-legend-unpatrolled' => '$1 - unpatrolled edit',
19721976 'recentchanges-label-unpatrolled' => 'This edit has not yet been patrolled',
19731977 'rcnote' => "Below {{PLURAL:$1|is '''1''' change|are the last '''$1''' changes}} in the last {{PLURAL:$2|day|'''$2''' days}}, as of $5, $4.",
19741978 'rcnotefrom' => "Below are the changes since '''$2''' (up to '''$1''' shown).",
Index: trunk/phase3/includes/ChangesList.php
@@ -124,6 +124,19 @@
125125 }
126126
127127 /**
 128+ * Some explanatory wrapper text for the given flag, to be used in a legend
 129+ * explaining what the flags mean. For instance, "N - new page". See
 130+ * also flag().
 131+ *
 132+ * @param $key string 'newpage', 'unpatrolled', 'minor', or 'bot'
 133+ * @return string Raw HTML
 134+ */
 135+ public static function flagLegend( $key ) {
 136+ return wfMsgExt( "recentchanges-legend-$key", array( 'escapenoentities',
 137+ 'replaceafter' ), self::flag( $key ) );
 138+ }
 139+
 140+ /**
128141 * Returns text for the start of the tabular part of RC
129142 * @return string
130143 */
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;
 412+ global $wgScript, $wgOut, $wgLang, $wgUser, $wgGroupPermissions;
413413
414414 $this->setTopText( $wgOut, $opts );
415415
@@ -457,12 +457,23 @@
458458 Xml::fieldset( wfMsg( 'recentchanges-legend' ), $panelString, array( 'class' => 'rcoptions' ) )
459459 );
460460
461 - # TODO: This is probably a bad format for the message. If anyone
462 - # customizes it and we add a new flag, it won't show up in the
463 - # customized message unless it's changed.
 461+ $flags = array( ChangesList::flagLegend( 'newpage' ),
 462+ ChangesList::flagLegend( 'minor' ) );
 463+
 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+
464476 $wgOut->addWikiMsg( 'recentchanges-label-legend',
465 - ChangesList::flag( 'newpage' ), ChangesList::flag( 'minor' ),
466 - ChangesList::flag( 'bot' ), ChangesList::flag( 'unpatrolled' ) );
 477+ $wgLang->commaList( $flags ) );
467478
468479 $this->setBottomText( $wgOut, $opts );
469480 }
Index: trunk/phase3/maintenance/language/messages.inc
@@ -1151,9 +1151,13 @@
11521152 'recentchangestext',
11531153 'recentchanges-feed-description',
11541154 'recentchanges-label-legend',
 1155+ 'recentchanges-legend-newpage',
11551156 'recentchanges-label-newpage',
 1157+ 'recentchanges-legend-minor',
11561158 'recentchanges-label-minor',
 1159+ 'recentchanges-legend-bot',
11571160 'recentchanges-label-bot',
 1161+ 'recentchanges-legend-unpatrolled',
11581162 'recentchanges-label-unpatrolled',
11591163 'rcnote',
11601164 'rcnotefrom',

Follow-up revisions

RevisionCommit summaryAuthorDate
r54355Fix flag legend for watchlist from r54336 breakage...simetrical10:59, 4 August 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r54242Add legend and tooltips to explain RC flags...simetrical22:15, 2 August 2009

Comments

#Comment by Nikerabbit (talk | contribs)   07:14, 4 August 2009
return wfMsgExt( "recentchanges-legend-$key", array( 'escapenoentities',

Just use 'escape' unless you need to support entities other than   and  

#Comment by Simetrical (talk | contribs)   00:03, 5 August 2009

Should 'escapenoentities' just be uniformly replaced with 'escape' and made a synonym for it?

#Comment by Nikerabbit (talk | contribs)   07:29, 5 August 2009

Yes. I am not aware of cases where other entities are needed, but there may be few.

#Comment by Umherirrender (talk | contribs)   10:44, 4 August 2009

Change for Watchlist is missing (r54248)

#Comment by Umherirrender (talk | contribs)   11:46, 4 August 2009

fixed in r54355 by simetrical

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

adding fixme for funky-looking legend, possibly pending removal

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

Giving this a shot...

Status & tagging log