Remove all instances of the word "iff"
[lhc/web/wiklou.git] / includes / Article.php
index c8e6ce2..0b18221 100644 (file)
@@ -1054,14 +1054,14 @@ class Article implements Page {
         * @return bool
         */
        public function showPatrolFooter() {
-               global $wgUseNPPatrol, $wgEnableAPI, $wgEnableWriteAPI;
+               global $wgUseNPPatrol, $wgUseRCPatrol, $wgEnableAPI, $wgEnableWriteAPI;
 
                $outputPage = $this->getContext()->getOutput();
                $user = $this->getContext()->getUser();
                $cache = wfGetMainCache();
                $rc = false;
 
-               if ( !$this->getTitle()->quickUserCan( 'patrol', $user ) || !$wgUseNPPatrol ) {
+               if ( !$this->getTitle()->quickUserCan( 'patrol', $user ) || !( $wgUseRCPatrol || $wgUseNPPatrol ) ) {
                        // Patrolling is disabled or the user isn't allowed to
                        return false;
                }
@@ -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 );
@@ -1546,13 +1553,7 @@ class Article implements Page {
 
                        $this->doDelete( $reason, $suppress );
 
-                       if ( $user->isLoggedIn() && $request->getCheck( 'wpWatch' ) != $user->isWatched( $title ) ) {
-                               if ( $request->getCheck( 'wpWatch' ) ) {
-                                       WatchAction::doWatch( $title, $user );
-                               } else {
-                                       WatchAction::doUnwatch( $title, $user );
-                               }
-                       }
+                       WatchAction::doWatchOrUnwatch( $request->getCheck( 'wpWatch' ), $title, $user );
 
                        return;
                }