Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -473,7 +473,7 @@ |
474 | 474 | $wgHooks['ContribsPager::getQueryInfo'][] = 'FlaggedRevsHooks::addToContribsQuery'; |
475 | 475 | $wgHooks['ContributionsLineEnding'][] = 'FlaggedRevsHooks::addToContribsLine'; |
476 | 476 | # Page review on edit |
477 | | -$wgHooks['ArticleUpdateBeforeRedirect'][] = 'FlaggedRevsHooks::injectReviewDiffURLParams'; |
| 477 | +$wgHooks['ArticleUpdateBeforeRedirect'][] = 'FlaggedRevsHooks::injectPostEditURLParams'; |
478 | 478 | # Diff-to-stable |
479 | 479 | $wgHooks['DiffViewHeader'][] = 'FlaggedRevsHooks::onDiffViewHeader'; |
480 | 480 | # Autoreview stuff |
Index: trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php |
— | — | @@ -100,6 +100,7 @@ |
101 | 101 | 'revreview-check-flag' => 'Mark pending edits reviewed', |
102 | 102 | 'revreview-edited' => '\'\'\'Changes will be [[{{MediaWiki:Validationpage}}|published]] once an authorised user [[{{MediaWiki:Validationpage}}|reviews]] them.\'\'\' |
103 | 103 | 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]]".', |
104 | 105 | 'revreview-flag' => 'Review this revision', |
105 | 106 | 'revreview-reflag' => 'Re-review this revision', |
106 | 107 | '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 @@ |
1807 | 1807 | return true; |
1808 | 1808 | } |
1809 | 1809 | |
1810 | | - public static function injectReviewDiffURLParams( $article, &$sectionAnchor, &$extraQuery ) { |
| 1810 | + public static function injectPostEditURLParams( $article, &$sectionAnchor, &$extraQuery ) { |
1811 | 1811 | $view = FlaggedArticleView::singleton(); |
1812 | | - $view->injectReviewDiffURLParams( $sectionAnchor, $extraQuery ); |
| 1812 | + $view->injectPostEditURLParams( $sectionAnchor, $extraQuery ); |
1813 | 1813 | return true; |
1814 | 1814 | } |
1815 | 1815 | |
Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php |
— | — | @@ -335,6 +335,11 @@ |
336 | 336 | $tooltip = wfMsgHtml( 'revreview-draft-title' ); |
337 | 337 | $pending = $prot . FlaggedRevsXML::draftStatusIcon() . |
338 | 338 | 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 | + } |
339 | 344 | # Notice should always use subtitle |
340 | 345 | $this->reviewNotice = "<div id='mw-fr-reviewnotice' " . |
341 | 346 | "class='flaggedrevs_preview plainlinks'>$pending</div>"; |
— | — | @@ -1368,32 +1373,46 @@ |
1369 | 1374 | * Redirect users out to review the changes to the stable version. |
1370 | 1375 | * Only for people who can review and for pages that have a stable version. |
1371 | 1376 | */ |
1372 | | - public function injectReviewDiffURLParams( &$sectionAnchor, &$extraQuery ) { |
| 1377 | + public function injectPostEditURLParams( &$sectionAnchor, &$extraQuery ) { |
1373 | 1378 | global $wgUser; |
1374 | 1379 | $this->load(); |
1375 | 1380 | # Don't show this for pages that are not reviewable |
1376 | | - if ( !$this->article->isReviewable() || $this->article->getTitle()->isTalkPage() ) |
| 1381 | + if ( !$this->article->isReviewable() ) { |
1377 | 1382 | return true; |
1378 | | - # We may want to skip some UI elements |
1379 | | - if ( $this->article->limitedUI() ) |
1380 | | - return true; |
| 1383 | + } |
1381 | 1384 | # Get the stable version, from master |
1382 | 1385 | $frev = $this->article->getStableRev( FR_MASTER ); |
1383 | | - if ( !$frev ) |
| 1386 | + if ( !$frev ) { |
1384 | 1387 | return true; |
| 1388 | + } |
1385 | 1389 | # Get latest revision Id (lag safe) |
1386 | 1390 | $latest = $this->article->getTitle()->getLatestRevID( GAID_FOR_UPDATE ); |
| 1391 | + if ( $latest == $frev->getRevId() ) { |
| 1392 | + return true; // only for pages with pending edits |
| 1393 | + } |
1387 | 1394 | // If the edit was not autoreviewed, and the user can actually make a |
1388 | 1395 | // new stable version, then go to the diff... |
1389 | | - if ( $latest > $frev->getRevId() && $frev->userCanSetFlags() ) { |
| 1396 | + if ( $frev->userCanSetFlags() ) { |
1390 | 1397 | $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'; |
1392 | 1400 | // ...otherwise, go to the current revision after completing an edit. |
| 1401 | + // This allows for users to immediately see their changes. |
1393 | 1402 | } 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 |
1398 | 1417 | } |
1399 | 1418 | } |
1400 | 1419 | } |