r88660 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88659‎ | r88660 | r88661 >
Date:17:54, 23 May 2011
Author:aaron
Status:ok
Tags:
Comment:
Don't autoreview the current rev when a null (same text) edit is attempted if the current rev is a dummy edit. Such edits indicate other change (title,protection) and can cause confusion. (bug 28476)
Modified paths:
  • /trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevs.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevs.hooks.php
@@ -520,6 +520,11 @@
521521 if ( !$user || $rev !== null ) {
522522 return true;
523523 }
 524+ # Rollback/undo or box checked
 525+ $reviewEdit = $wgRequest->getCheck( 'wpReviewEdit' );
 526+ if ( !$baseId && !$reviewEdit ) {
 527+ return true; // short-circuit
 528+ }
524529 $fa = FlaggedPage::getArticleInstance( $article );
525530 $fa->loadFromDB( FR_MASTER );
526531 if ( !$fa->isReviewable() ) {
@@ -534,9 +539,12 @@
535540 $flags = null;
536541 # Is this a rollback/undo that didn't change anything?
537542 if ( $baseId > 0 ) {
538 - $frev = FlaggedRevision::newFromTitle( $title, $baseId );
 543+ $frev = FlaggedRevision::newFromTitle( $title, $baseId ); // base rev of null edit
 544+ $pRev = Revision::newFromId( $rev->getParentId() ); // current rev parent
 545+ $revIsNull = ( $pRev && $pRev->getTextId() == $rev->getTextId() );
539546 # Was the edit that we tried to revert to reviewed?
540 - if ( $frev ) {
 547+ # We avoid auto-reviewing null edits to avoid confusion (bug 28476).
 548+ if ( $frev && !$revIsNull ) {
541549 # Review this revision of the page...
542550 $ok = FlaggedRevs::autoReviewEdit( $article, $user, $rev, $flags );
543551 if ( $ok ) {
@@ -549,10 +557,7 @@
550558 # Get edit timestamp, it must exist.
551559 $editTimestamp = $wgRequest->getVal( 'wpEdittime' );
552560 # Is the page checked off to be reviewed?
553 - if ( $editTimestamp
554 - && $wgRequest->getCheck( 'wpReviewEdit' )
555 - && $title->userCan( 'review' ) )
556 - {
 561+ if ( $editTimestamp && $reviewEdit && $title->userCan( 'review' ) ) {
557562 # Check wpEdittime against current revision's time.
558563 # If an edit was auto-merged in between, review only up to what
559564 # was the current rev when this user started editing the page.

Status & tagging log