r47617 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47616‎ | r47617 | r47618 >
Date:15:26, 21 February 2009
Author:aaron
Status:deferred
Tags:
Comment:
* Merged stripPatrolRights() with userCanPatrol() hook
* Fixed comment
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
@@ -341,9 +341,6 @@
342342 $wgAPIModules['review'] = 'ApiReview';
343343
344344 ######### Hook attachments #########
345 -# Remove stand-alone patrolling
346 -$wgHooks['UserGetRights'][] = 'FlaggedRevsHooks::stripPatrolRights';
347 -
348345 # Autopromote Editors
349346 $wgHooks['ArticleSaveComplete'][] = 'FlaggedRevsHooks::autoPromoteUser';
350347 # Adds table link references to include ones from the stable version
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -2,19 +2,6 @@
33
44 class FlaggedRevsHooks {
55 /**
6 - * Remove 'autopatrol' rights. Reviewing revisions will patrol them as well.
7 - */
8 - public static function stripPatrolRights( $user, &$rights ) {
9 - # Use only our extension mechanisms
10 - foreach( $rights as $n => $right ) {
11 - if( $right == 'autopatrol' ) {
12 - unset($rights[$n]);
13 - }
14 - }
15 - return true;
16 - }
17 -
18 - /**
196 * Add FlaggedRevs css/js.
207 */
218 public static function injectStyleAndJS() {
@@ -626,21 +613,22 @@
627614 }
628615
629616 /**
630 - * Don't let users pages pages not in $wgFlaggedRevsPatrolNamespaces
 617+ * Don't let users patrol pages not in $wgFlaggedRevsPatrolNamespaces
631618 */
632619 public static function userCanPatrol( $title, $user, $action, &$result ) {
633 - if( $action != 'patrol' || $result===false ) {
 620+ if( $result === false ) return true; // nothing to do
 621+ if( $action != 'patrol' && $action != 'autopatrol' ) {
634622 return true;
635623 }
636624 # Pages in reviewable namespace can be patrolled IF reviewing
637625 # is disabled for pages that don't show the stable by default.
638626 # In such cases, we let people with 'review' rights patrol them.
639 - if( FlaggedRevs::isPageReviewable($title) && !$user->isAllowed( 'review' ) ) {
 627+ if( FlaggedRevs::isPageReviewable($title) && !$user->isAllowed('review') ) {
640628 $result = false;
641629 return false;
642630 }
643631 $flaggedArticle = FlaggedArticle::getTitleInstance( $title );
644 - # The page must be in a patrollable namespace...
 632+ # The page must be in a patrollable namespace ($wgFlaggedRevsPatrolNamespaces)...
645633 if( !$flaggedArticle->isPatrollable() ) {
646634 global $wgUseNPPatrol;
647635 # ...unless the page is not in a reviewable namespace and

Status & tagging log