Index: trunk/extensions/FlaggedRevs/presentation/FlaggedRevsUI.hooks.php |
— | — | @@ -329,7 +329,7 @@ |
330 | 330 | $view = FlaggedPageView::singleton(); |
331 | 331 | $view->addReviewNotes( $data ); |
332 | 332 | $view->addReviewForm( $data ); |
333 | | - $view->addVisibilityLink( $data ); |
| 333 | + $view->addStabilizationLink( $data ); |
334 | 334 | } |
335 | 335 | return true; |
336 | 336 | } |
Index: trunk/extensions/FlaggedRevs/presentation/FlaggedPageView.php |
— | — | @@ -1098,7 +1098,7 @@ |
1099 | 1099 | /** |
1100 | 1100 | * Add link to stable version setting to protection form |
1101 | 1101 | */ |
1102 | | - public function addVisibilityLink( &$data ) { |
| 1102 | + public function addStabilizationLink( &$data ) { |
1103 | 1103 | global $wgRequest, $wgOut; |
1104 | 1104 | $this->load(); |
1105 | 1105 | if ( FlaggedRevs::useProtectionLevels() ) { |
— | — | @@ -1158,9 +1158,7 @@ |
1159 | 1159 | $actions['default'] = array( |
1160 | 1160 | 'class' => false, |
1161 | 1161 | 'text' => wfMsg( 'stabilization-tab' ), |
1162 | | - 'href' => $stableTitle->getLocalUrl( |
1163 | | - 'page=' . $title->getPrefixedUrl() |
1164 | | - ) |
| 1162 | + 'href' => $stableTitle->getLocalUrl( 'page=' . $title->getPrefixedUrl() ) |
1165 | 1163 | ); |
1166 | 1164 | } |
1167 | 1165 | return true; |
— | — | @@ -1171,13 +1169,15 @@ |
1172 | 1170 | * @param string $type ('flat' for SkinTemplateTabs, 'nav' for SkinTemplateNavigation) |
1173 | 1171 | */ |
1174 | 1172 | public function setViewTabs( Skin $skin, array &$views, $type ) { |
1175 | | - global $wgRequest; |
1176 | 1173 | $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 |
1179 | 1176 | } |
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 ); |
1182 | 1182 | } |
1183 | 1183 | $srev = $this->article->getStableRev(); |
1184 | 1184 | if ( !$srev ) { |
— | — | @@ -1284,6 +1284,22 @@ |
1285 | 1285 | } |
1286 | 1286 | |
1287 | 1287 | /** |
| 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 | + /** |
1288 | 1304 | * Adds a notice saying that this revision is pending review |
1289 | 1305 | * @param FlaggedRevision $srev The stable version |
1290 | 1306 | * @param string $diffToggle either "" or " <diff toggle><diff div>" |