r65153 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65152‎ | r65153 | r65154 >
Date:04:06, 17 April 2010
Author:aaron
Status:ok
Tags:
Comment:
(bug 23098) baseRevId should carry over preview/show changes
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticleView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php
@@ -1483,27 +1483,39 @@
14841484 }
14851485
14861486 /**
1487 - * Add a hidden revision ID field to edit form.
1488 - * Needed for autoreview so it can select the flags from said revision.
 1487+ * (a) Add a hidden field that has the rev ID the text is based off.
 1488+ * (b) If an edit was undone, add a hidden field that has the rev ID of that edit.
 1489+ * Needed for autoreview and user stats (for autopromote).
 1490+ * Note: baseRevId trusted for Reviewers - text checked for others.
14891491 */
1490 - public function addRevisionIDField( $editPage, $out ) {
 1492+ public function addRevisionIDField( EditPage $editPage, OutputPage $out ) {
14911493 global $wgRequest;
14921494 $this->load();
14931495 $article = $editPage->getArticle(); // convenience
14941496 $latestId = $article->getLatest(); // current rev
1495 - # Find the ID of the revision being edited
1496 - $revId = $article->getOldID();
1497 - if( !$revId ) { // zero oldid => current revision
1498 - $revId = $latestId;
1499 - }
1500 - # If undoing a few consecutive top edits, we can treat this
1501 - # like a revert to a base revision...find its ID...
15021497 $undo = $wgRequest->getIntOrNull( 'undo' );
1503 - if ( $undo === $latestId ) {
1504 - # We are undoing all edits *after* some rev...get that rev's ID
 1498+ # Undoing consecutive top edits...
 1499+ if ( $undo && $undo === $latestId ) {
 1500+ # Treat this like a revert to a base revision.
 1501+ # We are undoing all edits *after* some rev ID (undoafter).
 1502+ # If undoafter is not given, then it is the previous rev ID.
15051503 $revId = $wgRequest->getInt( 'undoafter',
15061504 $article->getTitle()->getPreviousRevisionID( $latestId, GAID_FOR_UPDATE ) );
 1505+ # Undoing other edits...
 1506+ } elseif ( $undo ) {
 1507+ $revId = $latestId; // current rev is the base rev
 1508+ # Other edits...
 1509+ } else {
 1510+ # If we are editing via oldid=X, then use that rev ID.
 1511+ # Otherwise, check if the client specified the ID (bug 23098).
 1512+ $revId = $article->getOldID()
 1513+ ? $article->getOldID()
 1514+ : $wgRequest->getInt( 'baseRevId' ); // e.g. "show changes"/"preview"
15071515 }
 1516+ # Zero oldid => current revision
 1517+ if ( !$revId ) {
 1518+ $revId = $latestId;
 1519+ }
15081520 $out->addHTML( "\n" . Xml::hidden( 'baseRevId', $revId ) );
15091521 $out->addHTML( "\n" . Xml::hidden( 'undidRev',
15101522 empty( $editPage->undidRev ) ? 0 : $editPage->undidRev )

Status & tagging log