r70589 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70588‎ | r70589 | r70590 >
Date:19:52, 6 August 2010
Author:reedy
Status:resolved (Comments)
Tags:
Comment:
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) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/backend/CodeRevision.php
@@ -301,12 +301,13 @@
302302 $dbw->insert( 'code_relations', $data, __METHOD__, array( 'IGNORE' ) );
303303 }
304304
305 - global $wgEnableEmail, $wgUser;
 305+ global $wgEnableEmail;
306306 // Email the authors of revisions that this follows up on
307307 if ( $wgEnableEmail && $newRevision && count( $affectedRevs ) > 0 ) {
308308 // Get committer wiki user name, or repo name at least
309 - $user = $this->getWikiUser();
310 - $committer = $user ? $user->getName() : htmlspecialchars( $this->mAuthor );
 309+ $commitAuthor = $this->getWikiUser();
 310+ $commitAuthorId = $commitAuthor->getId()
 311+ $committer = $commitAuthor ? $commitAuthor->getName() : htmlspecialchars( $this->mAuthor );
311312 // Get the authors of these revisions
312313 $res = $dbw->select( 'code_rev',
313314 array(
@@ -337,15 +338,17 @@
338339 $revision = CodeRevision::newFromRow( $row );
339340 $users = $revision->getCommentingUsers();
340341
341 - //Add the revision author if they have not already been added as a commentor (they won't want dupe emails!)
342 - if ( !array_key_exists( $user->getId(), $users ) {
343 - $users[$user->getId()] = $user;
 342+ $revisionAuthor = $revision->getWikiUser();
 343+
 344+ //Add the followup revision author if they have not already been added as a commentor (they won't want dupe emails!)
 345+ if ( !array_key_exists( $revisionAuthor->getId(), $users ) {
 346+ $users[$revisionAuthor->getId()] = $revisionAuthor;
344347 }
345348
346349 //Notify commenters and revision author of followup revision
347350 foreach ( $users as $userId => $user ) {
348 - // No sense in notifying the author if they are a commenter on the target rev
349 - if ( $wgUser->getId() == $user->getId() ) {
 351+ // No sense in notifying the author of this rev if they are a commenter/the author on the target rev
 352+ if ( $commitAuthorId == $user->getId() ) {
350353 continue;
351354 }
352355

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r70588*(bug 24689) Email all commenters when a followup rev is being committedreedy19:34, 6 August 2010

Comments

#Comment by Reedy (talk | contribs)   12:13, 7 August 2010

r70622 and r70623 fix this, but will need manually bringing in I suspect

Status & tagging log