r86420 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86419‎ | r86420 | r86421 >
Date:18:43, 19 April 2011
Author:aaron
Status:ok
Tags:
Comment:
* Redid "maybe load from master" check in setViewTabs() which was removed in r85923; added 'delete' check too
* Other minor setViewTabs() cleanups
* Renamed addVisibilityLink() -> addStabilizationLink()
Modified paths:
  • /trunk/extensions/FlaggedRevs/presentation/FlaggedPageView.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/presentation/FlaggedRevsUI.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/presentation/FlaggedRevsUI.hooks.php
@@ -329,7 +329,7 @@
330330 $view = FlaggedPageView::singleton();
331331 $view->addReviewNotes( $data );
332332 $view->addReviewForm( $data );
333 - $view->addVisibilityLink( $data );
 333+ $view->addStabilizationLink( $data );
334334 }
335335 return true;
336336 }
Index: trunk/extensions/FlaggedRevs/presentation/FlaggedPageView.php
@@ -1098,7 +1098,7 @@
10991099 /**
11001100 * Add link to stable version setting to protection form
11011101 */
1102 - public function addVisibilityLink( &$data ) {
 1102+ public function addStabilizationLink( &$data ) {
11031103 global $wgRequest, $wgOut;
11041104 $this->load();
11051105 if ( FlaggedRevs::useProtectionLevels() ) {
@@ -1158,9 +1158,7 @@
11591159 $actions['default'] = array(
11601160 'class' => false,
11611161 'text' => wfMsg( 'stabilization-tab' ),
1162 - 'href' => $stableTitle->getLocalUrl(
1163 - 'page=' . $title->getPrefixedUrl()
1164 - )
 1162+ 'href' => $stableTitle->getLocalUrl( 'page=' . $title->getPrefixedUrl() )
11651163 );
11661164 }
11671165 return true;
@@ -1171,13 +1169,15 @@
11721170 * @param string $type ('flat' for SkinTemplateTabs, 'nav' for SkinTemplateNavigation)
11731171 */
11741172 public function setViewTabs( Skin $skin, array &$views, $type ) {
1175 - global $wgRequest;
11761173 $this->load();
1177 - if ( $this->article->getTitle()->isTalkPage() ) {
1178 - return true; // leave talk pages alone
 1174+ if ( !FlaggedRevs::inReviewNamespace( $this->article->getTitle() ) ) {
 1175+ return true; // short-circuit for non-reviewable pages
11791176 }
1180 - if ( !$this->article->isReviewable() ) {
1181 - return true; // Not a reviewable page or the UI is hidden
 1177+ # Hack for bug 16734 (some actions update and view all at once)
 1178+ if ( $this->pageWriteOpRequested() && wfGetDB( DB_MASTER )->doneWrites() ) {
 1179+ # Tabs need to reflect the new stable version so users actually
 1180+ # see the results of their action (i.e. "delete"/"rollback")
 1181+ $this->article->loadFromDB( FR_MASTER );
11821182 }
11831183 $srev = $this->article->getStableRev();
11841184 if ( !$srev ) {
@@ -1284,6 +1284,22 @@
12851285 }
12861286
12871287 /**
 1288+ * Check if a flaggedrevs relevant write op was done this page view
 1289+ * @return bool
 1290+ */
 1291+ protected function pageWriteOpRequested() {
 1292+ global $wgRequest, $mediaWiki;
 1293+ # Hack for bug 16734 (some actions update and view all at once)
 1294+ $action = $mediaWiki->getAction();
 1295+ if ( $action === 'rollback' ) {
 1296+ return true;
 1297+ } elseif ( $action === 'delete' && $wgRequest->wasPosted() ) {
 1298+ return true;
 1299+ }
 1300+ return false;
 1301+ }
 1302+
 1303+ /**
12881304 * Adds a notice saying that this revision is pending review
12891305 * @param FlaggedRevision $srev The stable version
12901306 * @param string $diffToggle either "" or " <diff toggle><diff div>"

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r85923Removed use of FR_MASTER per code commentaaron21:38, 12 April 2011

Status & tagging log