http://www.mediawiki.org/wiki/Special:Code/MediaWiki/70589

Revision: 70589
Author:   reedy
Date:     2010-08-06 19:52:45 +0000 (Fri, 06 Aug 2010)

Log Message:
-----------
Minor followup to r70588

Multiple declaration of the things using the same variable

Remove wgUser (wouldn't actually be valid here!)

Clarify some variables

Modified Paths:
--------------
    trunk/extensions/CodeReview/backend/CodeRevision.php

Modified: trunk/extensions/CodeReview/backend/CodeRevision.php
===================================================================
--- trunk/extensions/CodeReview/backend/CodeRevision.php        2010-08-06 
19:34:13 UTC (rev 70588)
+++ trunk/extensions/CodeReview/backend/CodeRevision.php        2010-08-06 
19:52:45 UTC (rev 70589)
@@ -301,12 +301,13 @@
                        $dbw->insert( 'code_relations', $data, __METHOD__, 
array( 'IGNORE' ) );
                }
 
-               global $wgEnableEmail, $wgUser;
+               global $wgEnableEmail;
                // Email the authors of revisions that this follows up on
                if ( $wgEnableEmail && $newRevision && count( $affectedRevs ) > 
0 ) {
                        // Get committer wiki user name, or repo name at least
-                       $user = $this->getWikiUser();
-                       $committer = $user ? $user->getName() : 
htmlspecialchars( $this->mAuthor );
+                       $commitAuthor = $this->getWikiUser();
+                       $commitAuthorId = $commitAuthor->getId()
+                       $committer = $commitAuthor ? $commitAuthor->getName() : 
htmlspecialchars( $this->mAuthor );
                        // Get the authors of these revisions
                        $res = $dbw->select( 'code_rev',
                                array( 
@@ -337,15 +338,17 @@
                                $revision = CodeRevision::newFromRow( $row );
                                $users = $revision->getCommentingUsers();
                                
-                               //Add the revision author if they have not 
already been added as a commentor (they won't want dupe emails!)
-                               if ( !array_key_exists( $user->getId(), $users 
) {
-                                       $users[$user->getId()] = $user;
+                               $revisionAuthor = $revision->getWikiUser();
+                               
+                               //Add the followup revision author if they have 
not already been added as a commentor (they won't want dupe emails!)
+                               if ( !array_key_exists( 
$revisionAuthor->getId(), $users ) {
+                                       $users[$revisionAuthor->getId()] = 
$revisionAuthor;
                                }
 
                                //Notify commenters and revision author of 
followup revision
                                foreach ( $users as $userId => $user ) {
-                                       // No sense in notifying the author if 
they are a commenter on the target rev
-                                       if ( $wgUser->getId() == $user->getId() 
) {
+                                       // No sense in notifying the author of 
this rev if they are a commenter/the author on the target rev
+                                       if ( $commitAuthorId == $user->getId() 
) {
                                                continue;
                                        }       
 



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to