r47402 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47401‎ | r47402 | r47403 >
Date:00:23, 18 February 2009
Author:aaron
Status:deferred
Tags:
Comment:
(bug 17545) Allowing sighting of a page with null edit & the review checkbox
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -253,7 +253,7 @@
254254 $wgAvailableRights[] = 'movestable';
255255
256256 # Bump this number every time you change flaggedrevs.css/flaggedrevs.js
257 -$wgFlaggedRevStyleVersion = 53;
 257+$wgFlaggedRevStyleVersion = 54;
258258
259259 $wgExtensionFunctions[] = 'efLoadFlaggedRevs';
260260
@@ -421,6 +421,8 @@
422422 $wgHooks['NewDifferenceEngine'][] = 'FlaggedRevsHooks::checkDiffUrl';
423423 # Check if a page is being reviewed
424424 $wgHooks['MediaWikiPerformAction'][] = 'FlaggedRevsHooks::markUnderReview';
 425+# Null edit review via checkbox
 426+$wgHooks['ArticleSaveComplete'][] = 'FlaggedRevsHooks::maybeNullEditReview';
425427
426428 # Add CSS/JS as needed
427429 $wgHooks['OutputPageParserOutput'][] = 'FlaggedRevsHooks::injectStyleAndJS';
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -757,6 +757,34 @@
758758 }
759759 return true;
760760 }
 761+
 762+ /**
 763+ * When an user makes a null-edit with the review checkbox ticked
 764+ */
 765+ public static function maybeNullEditReview( $article, $user, &$text, &$summary, &$m, &$a, &$b, &$f, $rev ) {
 766+ global $wgRequest;
 767+ # Must be in reviewable namespace
 768+ $title = $article->getTitle();
 769+ # Revision must *be* null (null edit). We also need the user who made the edit.
 770+ if( !$user || $rev !== NULL || !FlaggedRevs::isPageReviewable( $title ) ) {
 771+ return true;
 772+ }
 773+ # Get the just the current revision ID
 774+ $rev = Revision::newFromTitle( $title );
 775+ $flags = null;
 776+ # Get edit timestamp, it must exist.
 777+ $editTimestamp = $wgRequest->getVal('wpEdittime');
 778+ # Is the page checked off to be reviewed?
 779+ if( $rev && $editTimestamp && $wgRequest->getCheck('wpReviewEdit') && $user->isAllowed('review') ) {
 780+ # Review this revision of the page. Let articlesavecomplete hook do rc_patrolled bit.
 781+ # Don't do so if an edit was auto-merged in between though...
 782+ if( $rev->getTimestamp() == $editTimestamp ) {
 783+ FlaggedRevs::autoReviewEdit( $article, $user, $rev->getText(), $rev, $flags, false );
 784+ return true; // done!
 785+ }
 786+ }
 787+ return true;
 788+ }
761789
762790 /**
763791 * When an edit is made to a page that can't be reviewed, autopatrol if allowed.

Follow-up revisions

RevisionCommit summaryAuthorDate
r47435Fix for r47402: make sure the rev is also mark patrolledaaron08:42, 18 February 2009

Status & tagging log