Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -253,7 +253,7 @@ |
254 | 254 | $wgAvailableRights[] = 'movestable'; |
255 | 255 | |
256 | 256 | # Bump this number every time you change flaggedrevs.css/flaggedrevs.js |
257 | | -$wgFlaggedRevStyleVersion = 53; |
| 257 | +$wgFlaggedRevStyleVersion = 54; |
258 | 258 | |
259 | 259 | $wgExtensionFunctions[] = 'efLoadFlaggedRevs'; |
260 | 260 | |
— | — | @@ -421,6 +421,8 @@ |
422 | 422 | $wgHooks['NewDifferenceEngine'][] = 'FlaggedRevsHooks::checkDiffUrl'; |
423 | 423 | # Check if a page is being reviewed |
424 | 424 | $wgHooks['MediaWikiPerformAction'][] = 'FlaggedRevsHooks::markUnderReview'; |
| 425 | +# Null edit review via checkbox |
| 426 | +$wgHooks['ArticleSaveComplete'][] = 'FlaggedRevsHooks::maybeNullEditReview'; |
425 | 427 | |
426 | 428 | # Add CSS/JS as needed |
427 | 429 | $wgHooks['OutputPageParserOutput'][] = 'FlaggedRevsHooks::injectStyleAndJS'; |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -757,6 +757,34 @@ |
758 | 758 | } |
759 | 759 | return true; |
760 | 760 | } |
| 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 | + } |
761 | 789 | |
762 | 790 | /** |
763 | 791 | * When an edit is made to a page that can't be reviewed, autopatrol if allowed. |