Use more thorough Title->userCan('patrol')
authorAaron Schulz <aaron@users.mediawiki.org>
Wed, 17 Dec 2008 07:17:59 +0000 (07:17 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Wed, 17 Dec 2008 07:17:59 +0000 (07:17 +0000)
includes/Article.php
includes/diff/DifferenceEngine.php

index eb8f329..c6e3c88 100644 (file)
@@ -914,7 +914,7 @@ class Article {
 
                # If we have been passed an &rcid= parameter, we want to give the user a
                # chance to mark this new article as patrolled.
-               if( !is_null( $rcid ) && $rcid != 0 && $wgUser->isAllowed( 'patrol' ) && $this->mTitle->exists() ) {
+               if( !empty($rcid) && $this->mTitle->exists() && $this->mTitle->userCan('patrol') ) {
                        $wgOut->addHTML(
                                "<div class='patrollink'>" .
                                        wfMsgHtml( 'markaspatrolledlink',
index 032bfdf..f418b5a 100644 (file)
@@ -166,7 +166,7 @@ CONTROL;
                }
 
                // Prepare a change patrol link, if applicable
-               if( $wgUseRCPatrol && $wgUser->isAllowed( 'patrol' ) ) {
+               if( $wgUseRCPatrol && $this->mTitle->userCan('patrol') ) {
                        // If we've been given an explicit change identifier, use it; saves time
                        if( $this->mRcidMarkPatrolled ) {
                                $rcid = $this->mRcidMarkPatrolled;
@@ -177,10 +177,10 @@ CONTROL;
                                array(
                                // Add redundant user,timestamp condition so we can use the existing index
                                                'rc_user_text'  => $this->mNewRev->getUserText( Revision::FOR_THIS_USER ),
-                                               'rc_timestamp' => $db->timestamp( $this->mNewRev->getTimestamp() ),
+                                               'rc_timestamp'  => $db->timestamp( $this->mNewRev->getTimestamp() ),
                                                'rc_this_oldid' => $this->mNewid,
                                                'rc_last_oldid' => $this->mOldid,
-                                               'rc_patrolled' => 0
+                                               'rc_patrolled'  => 0
                                ),
                                __METHOD__
                                );
@@ -194,10 +194,10 @@ CONTROL;
                        // Build the link
                        if( $rcid ) {
                                $patrol = ' <span class="patrollink">[' . $sk->makeKnownLinkObj(
-                               $this->mTitle,
-                               wfMsgHtml( 'markaspatrolleddiff' ),
-                                       "action=markpatrolled&rcid={$rcid}"
-                               ) . ']</span>';
+                                       $this->mTitle,
+                                       wfMsgHtml( 'markaspatrolleddiff' ),
+                                               "action=markpatrolled&rcid={$rcid}"
+                                       ) . ']</span>';
                        } else {
                                $patrol = '';
                        }