r111214 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111213‎ | r111214 | r111215 >
Date:23:16, 10 February 2012
Author:aaron
Status:ok
Tags:
Comment:
Small logic cleanups to maybeMakeEditReviewed(). There can be no base ID if there was no prior revision. Only trust 'baseRevId' if 'wpReviewEdit' was given to be safe. Also removed redundant $baseRevId conditional for existing pages.
Modified paths:
  • /trunk/extensions/FlaggedRevs/backend/FlaggedRevs.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/backend/FlaggedRevs.hooks.php
@@ -344,7 +344,7 @@
345345 * (b) The edit is a self-revert to the stable version (by anyone)
346346 * (c) The user can 'autoreview' new pages and this edit is a new page
347347 * (d) The user can 'review' and the "review pending edits" checkbox was checked
348 - *
 348+ *
349349 * Note: RC items not inserted yet, RecentChange_save hook does rc_patrolled bit...
350350 * Note: $article one of Article, ImagePage, Category page as appropriate.
351351 */
@@ -386,8 +386,8 @@
387387 # been the current version. If not reflected in wpEdittime, an
388388 # edit may have been auto-merged in between, in that case, discard
389389 # the baseRevId given from the client.
390 - if ( !$editTimestamp || $prevTimestamp == $editTimestamp ) {
391 - $baseRevId = intval( trim( $wgRequest->getVal( 'baseRevId' ) ) );
 390+ if ( $editTimestamp && $prevTimestamp === $editTimestamp ) {
 391+ $baseRevId = $wgRequest->getInt( 'baseRevId' );
392392 }
393393 # If baseRevId not given, assume the previous revision ID (for bots).
394394 # For auto-merges, this also occurs since the given ID is ignored.
@@ -401,12 +401,10 @@
402402 # (a) this new revision creates a new page and new page autoreview is enabled
403403 # (b) this new revision is based on an old, reviewed, revision
404404 if ( $title->getUserPermissionsErrors( 'autoreview', $user ) === array() ) {
405 - // New pages
406 - if ( !$prevRevId ) {
 405+ if ( !$prevRevId ) { // New pages
407406 $reviewableNewPage = FlaggedRevs::autoReviewNewPages();
408407 $reviewableChange = false;
409 - // Edits to existing pages
410 - } elseif ( $baseRevId ) {
 408+ } else { // Edits to existing pages
411409 $reviewableNewPage = false; // had previous rev
412410 # Check if the base revision was reviewed...
413411 if ( FlaggedRevs::autoReviewEdits() ) {

Sign-offs

UserFlagDate
Awjrichardsinspected23:25, 17 February 2012

Status & tagging log