From: Marius Hoch Date: Sat, 20 Jul 2013 19:24:20 +0000 (+0200) Subject: Don't ask users to mark own page creations as patrolled X-Git-Tag: 1.31.0-rc.0~18760^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/membres/fiche.php?a=commitdiff_plain;h=038602f9bcea032ee20943193c8ac1de210d8248;p=lhc%2Fweb%2Fwiklou.git Don't ask users to mark own page creations as patrolled Bug: 51224 Change-Id: I2d38c25b547a8735da135955854584aa02b4394d --- diff --git a/includes/Article.php b/includes/Article.php index 732b1c20c9..0b18221a0a 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1121,6 +1121,13 @@ class Article implements Page { return false; } + if ( $rc->getPerformer()->getName() == $user->getName() ) { + // Don't show a patrol link for own creations. If the user could + // patrol them, they already would be patrolled + wfProfileOut( __METHOD__ ); + return false; + } + $rcid = $rc->getAttribute( 'rc_id' ); $token = $user->getEditToken( $rcid ); diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index 665766775d..b742873074 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -416,12 +416,13 @@ class DifferenceEngine extends ContextSource { */ protected function markPatrolledLink() { global $wgUseRCPatrol, $wgEnableAPI, $wgEnableWriteAPI; + $user = $this->getUser(); if ( $this->mMarkPatrolledLink === null ) { // Prepare a change patrol link, if applicable if ( // Is patrolling enabled and the user allowed to? - $wgUseRCPatrol && $this->mNewPage->quickUserCan( 'patrol', $this->getUser() ) && + $wgUseRCPatrol && $this->mNewPage->quickUserCan( 'patrol', $user ) && // Only do this if the revision isn't more than 6 hours older // than the Max RC age (6h because the RC might not be cleaned out regularly) RecentChange::isInRCLifespan( $this->mNewRev->getTimestamp(), 21600 ) @@ -439,22 +440,23 @@ class DifferenceEngine extends ContextSource { array( 'USE INDEX' => 'rc_timestamp' ) ); - if ( $change ) { + if ( $change && $change->getPerformer()->getName() !== $user->getName() ) { $rcid = $change->getAttribute( 'rc_id' ); } else { - // None found + // None found or the page has been created by the current user. + // If the user could patrol this it already would be patrolled $rcid = 0; } // Build the link if ( $rcid ) { $this->getOutput()->preventClickjacking(); if ( $wgEnableAPI && $wgEnableWriteAPI - && $this->getUser()->isAllowed( 'writeapi' ) + && $user->isAllowed( 'writeapi' ) ) { $this->getOutput()->addModules( 'mediawiki.page.patrol.ajax' ); } - $token = $this->getUser()->getEditToken( $rcid ); + $token = $user->getEditToken( $rcid ); $this->mMarkPatrolledLink = ' [' . Linker::linkKnown( $this->mNewPage, $this->msg( 'markaspatrolleddiff' )->escaped(),