r60250 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60249‎ | r60250 | r60251 >
Date:03:57, 21 December 2009
Author:aaron
Status:ok
Tags:
Comment:
* Refactored getStableRev()
* Cleaned up setViewTabs()
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticle.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedArticleView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php
@@ -118,10 +118,8 @@
119119 if( !is_null($this->stableRev) ) {
120120 return $this->stableRev;
121121 }
122 - # Get the content page, skip talk
123 - $title = $this->getTitle()->getSubjectPage();
124122 # Do we have one?
125 - $srev = FlaggedRevision::newFromStable( $title, $flags );
 123+ $srev = FlaggedRevision::newFromStable( $this->getTitle(), $flags );
126124 if( $srev ) {
127125 $this->stableRev = $srev;
128126 $this->flags[$srev->getRevId()] = $srev->getTags();
Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php
@@ -927,26 +927,26 @@
928928 * SkinTemplateTabs, to inlude flagged revs UI elements
929929 */
930930 public function setViewTabs( $skin, &$views ) {
931 - global $wgRequest, $wgUser, $wgFlaggedRevTabs;
 931+ global $wgRequest, $wgUser;
932932 $this->load();
 933+ // Get the actual content page
 934+ $title = $this->article->getTitle()->getSubjectPage();
 935+ $fa = FlaggedArticle::getTitleInstance( $title );
933936
934 - $title = $this->article->getTitle()->getSubjectPage(); // Get the actual content page
935 - $article = new Article( $title );
936937 $action = $wgRequest->getVal( 'action', 'view' );
937 - $fa = FlaggedArticle::getTitleInstance( $title );
938 - if ( !$fa->isReviewable() || $this->article->limitedUI() ) {
939 - // This isn't a reviewable page or the UI is hidden
940 - return true;
 938+ if ( !$fa->isReviewable() || $fa->limitedUI() ) {
 939+ return true; // Not a reviewable page or the UI is hidden
941940 }
942 - $srev = $this->article->getStableRev( $action == 'rollback' ? FR_MASTER : 0 );
943 - if( is_null( $srev ) ) {
 941+ $flags = ($action == 'rollback') ? FR_MASTER : 0;
 942+ $srev = $fa->getStableRev( $flags );
 943+ if( !$srev ) {
944944 return true; // No stable revision exists
945945 }
946 - $synced = FlaggedRevs::stableVersionIsSynced( $srev, $article );
 946+ $synced = FlaggedRevs::stableVersionIsSynced( $srev, $fa );
947947 // Set draft tab as needed...
948948 if ( !$skin->mTitle->isTalkPage() && !$synced ) {
949949 if ( isset( $views['edit'] ) ) {
950 - if ( $this->article->showStableByDefault() ) {
 950+ if ( $fa->showStableByDefault() ) {
951951 $views['edit']['text'] = wfMsg('revreview-edit');
952952 }
953953 if ( $this->pageOverride() ) {
@@ -954,7 +954,7 @@
955955 }
956956 }
957957 if ( isset( $views['viewsource'] ) ) {
958 - if ( $this->article->showStableByDefault() ) {
 958+ if ( $fa->showStableByDefault() ) {
959959 $views['viewsource']['text'] = wfMsg('revreview-source');
960960 }
961961 if ( $this->pageOverride() ) {
@@ -962,7 +962,7 @@
963963 }
964964 }
965965 }
966 - if ( !$wgFlaggedRevTabs || $synced ) {
 966+ if ( !FlaggedRevs::showVersionTabs() || $synced ) {
967967 // Exit, since either the stable/draft tabs should not be shown
968968 // or the page is already the most current revision
969969 return true;

Status & tagging log