r61451 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61450‎ | r61451 | r61452 >
Date:01:52, 24 January 2010
Author:aaron
Status:ok
Tags:
Comment:
Go to "changes pending" message at the top of the page even for section edits, but give a link back to the section.
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticleView.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -473,7 +473,7 @@
474474 $wgHooks['ContribsPager::getQueryInfo'][] = 'FlaggedRevsHooks::addToContribsQuery';
475475 $wgHooks['ContributionsLineEnding'][] = 'FlaggedRevsHooks::addToContribsLine';
476476 # Page review on edit
477 -$wgHooks['ArticleUpdateBeforeRedirect'][] = 'FlaggedRevsHooks::injectReviewDiffURLParams';
 477+$wgHooks['ArticleUpdateBeforeRedirect'][] = 'FlaggedRevsHooks::injectPostEditURLParams';
478478 # Diff-to-stable
479479 $wgHooks['DiffViewHeader'][] = 'FlaggedRevsHooks::onDiffViewHeader';
480480 # Autoreview stuff
Index: trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php
@@ -100,6 +100,7 @@
101101 'revreview-check-flag' => 'Mark pending edits reviewed',
102102 'revreview-edited' => '\'\'\'Changes will be [[{{MediaWiki:Validationpage}}|published]] once an authorised user [[{{MediaWiki:Validationpage}}|reviews]] them.\'\'\'
103103 The \'\'draft\'\', shown below, contains [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} $2 pending {{PLURAL:$2|change|changes}}].',
 104+ 'revreview-edited-section' => 'Return to page section named "[[#$1|$2]]".',
104105 'revreview-flag' => 'Review this revision',
105106 'revreview-reflag' => 'Re-review this revision',
106107 'revreview-invalid' => '\'\'\'Invalid target:\'\'\' no [[{{MediaWiki:Validationpage}}|reviewed]] revision corresponds to the given ID.',
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -1806,9 +1806,9 @@
18071807 return true;
18081808 }
18091809
1810 - public static function injectReviewDiffURLParams( $article, &$sectionAnchor, &$extraQuery ) {
 1810+ public static function injectPostEditURLParams( $article, &$sectionAnchor, &$extraQuery ) {
18111811 $view = FlaggedArticleView::singleton();
1812 - $view->injectReviewDiffURLParams( $sectionAnchor, $extraQuery );
 1812+ $view->injectPostEditURLParams( $sectionAnchor, $extraQuery );
18131813 return true;
18141814 }
18151815
Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php
@@ -335,6 +335,11 @@
336336 $tooltip = wfMsgHtml( 'revreview-draft-title' );
337337 $pending = $prot . FlaggedRevsXML::draftStatusIcon() .
338338 wfMsgExt( 'revreview-edited', array( 'parseinline' ), $srev->getRevId(), $revsSince );
 339+ $anchor = $wgRequest->getText( 'fromsection' );
 340+ if( $anchor != null ) {
 341+ $section = str_replace( '_', ' ', $anchor ); // prettify
 342+ $pending .= wfMsgExt( 'revreview-edited-section', 'parse', $anchor, $section );
 343+ }
339344 # Notice should always use subtitle
340345 $this->reviewNotice = "<div id='mw-fr-reviewnotice' " .
341346 "class='flaggedrevs_preview plainlinks'>$pending</div>";
@@ -1368,32 +1373,46 @@
13691374 * Redirect users out to review the changes to the stable version.
13701375 * Only for people who can review and for pages that have a stable version.
13711376 */
1372 - public function injectReviewDiffURLParams( &$sectionAnchor, &$extraQuery ) {
 1377+ public function injectPostEditURLParams( &$sectionAnchor, &$extraQuery ) {
13731378 global $wgUser;
13741379 $this->load();
13751380 # Don't show this for pages that are not reviewable
1376 - if ( !$this->article->isReviewable() || $this->article->getTitle()->isTalkPage() )
 1381+ if ( !$this->article->isReviewable() ) {
13771382 return true;
1378 - # We may want to skip some UI elements
1379 - if ( $this->article->limitedUI() )
1380 - return true;
 1383+ }
13811384 # Get the stable version, from master
13821385 $frev = $this->article->getStableRev( FR_MASTER );
1383 - if ( !$frev )
 1386+ if ( !$frev ) {
13841387 return true;
 1388+ }
13851389 # Get latest revision Id (lag safe)
13861390 $latest = $this->article->getTitle()->getLatestRevID( GAID_FOR_UPDATE );
 1391+ if ( $latest == $frev->getRevId() ) {
 1392+ return true; // only for pages with pending edits
 1393+ }
13871394 // If the edit was not autoreviewed, and the user can actually make a
13881395 // new stable version, then go to the diff...
1389 - if ( $latest > $frev->getRevId() && $frev->userCanSetFlags() ) {
 1396+ if ( $frev->userCanSetFlags() ) {
13901397 $extraQuery .= $extraQuery ? '&' : '';
1391 - $extraQuery .= "oldid={$frev->getRevId()}&diff=cur&diffonly=0"; // override diff-only
 1398+ // Override diffonly setting to make sure the content is shown
 1399+ $extraQuery .= 'oldid='.intval($frev->getRevId()).'&diff=cur&diffonly=0';
13921400 // ...otherwise, go to the current revision after completing an edit.
 1401+ // This allows for users to immediately see their changes.
13931402 } else {
1394 - if ( $frev && $latest != $frev->getRevId() ) {
1395 - $extraQuery .= "stable=0";
1396 - if ( !$wgUser->isAllowed( 'review' ) && $this->article->isStableShownByDefault() ) {
1397 - $extraQuery .= "&shownotice=1";
 1403+ $extraQuery .= $extraQuery ? '&' : '';
 1404+ $extraQuery .= 'stable=0';
 1405+ // Show a notice at the top of the page for non-reviewers...
 1406+ if ( !$wgUser->isAllowed( 'review' ) && $this->article->isStableShownByDefault() ) {
 1407+ $extraQuery .= '&shownotice=1';
 1408+ if( $sectionAnchor ) {
 1409+ // Pass a section parameter in the URL as needed to add a link to
 1410+ // the "your changes are pending" box on the top of the page...
 1411+ $section = str_replace(
 1412+ array( ':' , '.' ), array( '%3A', '%' ), // hack: reverse special encoding
 1413+ substr( $sectionAnchor, 1 ) // remove the '#'
 1414+ );
 1415+ $extraQuery .= '&fromsection=' . $section;
 1416+ $sectionAnchor = ''; // go to the top of the page to see notice
13981417 }
13991418 }
14001419 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r61452Follow up r61451: getText() -> getVal()aaron01:56, 24 January 2010

Status & tagging log