r100877 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100876‎ | r100877 | r100878 >
Date:21:26, 26 October 2011
Author:aaron
Status:ok
Tags:
Comment:
Cleaned up request handling in getBaseRevId() a bit
Modified paths:
  • /trunk/extensions/FlaggedRevs/presentation/FlaggablePageView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/presentation/FlaggablePageView.php
@@ -1785,7 +1785,7 @@
17861786 return true; // edit will be autoreviewed
17871787 }
17881788 if ( !isset( $editPage->fr_baseFRev ) ) {
1789 - $baseRevId = self::getBaseRevId( $editPage );
 1789+ $baseRevId = self::getBaseRevId( $editPage, $this->getRequest() );
17901790 $editPage->fr_baseFRev = FlaggedRevision::newFromTitle( $title, $baseRevId );
17911791 }
17921792 if ( $editPage->fr_baseFRev ) {
@@ -1808,7 +1808,7 @@
18091809 } elseif ( $this->editWillBeAutoreviewed( $editPage ) ) {
18101810 return true; // edit will be auto-reviewed
18111811 }
1812 - if ( self::getBaseRevId( $editPage ) == $this->article->getLatest() ) {
 1812+ if ( self::getBaseRevId( $editPage, $request ) == $this->article->getLatest() ) {
18131813 # For pages with either no stable version, or an outdated one, let
18141814 # the user decide if he/she wants it reviewed on the spot. One might
18151815 # do this if he/she just saw the diff-to-stable and *then* decided to edit.
@@ -1849,13 +1849,11 @@
18501850 * Note: baseRevId trusted for Reviewers - text checked for others.
18511851 */
18521852 public function addRevisionIDField( EditPage $editPage, OutputPage $out ) {
1853 - $this->load();
1854 - $revId = self::getBaseRevId( $editPage );
 1853+ $revId = self::getBaseRevId( $editPage, $this->getRequest() );
18551854 $out->addHTML( "\n" . Html::hidden( 'baseRevId', $revId ) );
18561855 $out->addHTML( "\n" . Html::hidden( 'undidRev',
18571856 empty( $editPage->undidRev ) ? 0 : $editPage->undidRev )
18581857 );
1859 - return true;
18601858 }
18611859
18621860 /**
@@ -1863,8 +1861,7 @@
18641862 * Note: baseRevId trusted for Reviewers - check text for others.
18651863 * @return int
18661864 */
1867 - protected static function getBaseRevId( EditPage $editPage ) {
1868 - $request = FlaggablePageView::singleton()->getRequest();
 1865+ protected static function getBaseRevId( EditPage $editPage, WebRequest $request ) {
18691866 if ( !isset( $editPage->fr_baseRevId ) ) {
18701867 $article = $editPage->getArticle(); // convenience
18711868 $latestId = $article->getLatest(); // current rev

Status & tagging log