r83186 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83185‎ | r83186 | r83187 >
Date:00:06, 4 March 2011
Author:reedy
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/wmf/1.17wmf1/extensions/CodeReview/backend/CodeRevision.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/extensions/CodeReview/backend/CodeRevision.php
@@ -333,8 +333,10 @@
334334 if ( $wgEnableEmail && $newRevision && count( $affectedRevs ) > 0 ) {
335335 // Get committer wiki user name, or repo name at least
336336 $commitAuthor = $this->getWikiUser();
337 - # Author might not have a username in the wiki:
 337+
 338+ $commitAuthorId = $commitAuthor->getId();
338339 $committer = $commitAuthor ? $commitAuthor->getName() : htmlspecialchars( $this->mAuthor );
 340+
339341 // Get the authors of these revisions
340342 $res = $dbw->select( 'code_rev',
341343 array(
@@ -369,12 +371,17 @@
370372 $revisionAuthor = $revision->getWikiUser();
371373
372374 //Add the followup revision author if they have not already been added as a commentor (they won't want dupe emails!)
373 - if ( $revisionAuthor && !array_key_exists( $revisionAuthor->getId(), $users ) ) {
 375+ if ( !array_key_exists( $revisionAuthor->getId(), $users ) ) {
374376 $users[$revisionAuthor->getId()] = $revisionAuthor;
375377 }
376378
377379 //Notify commenters and revision author of followup revision
378380 foreach ( $users as $user ) {
 381+ // No sense in notifying the author of this rev if they are a commenter/the author on the target rev
 382+ if ( $commitAuthorId == $user->getId() ) {
 383+ continue;
 384+ }
 385+
379386 if ( $user->canReceiveEmail() ) {
380387 // Send message in receiver's language
381388 $lang = array( 'language' => $user->getOption( 'language' ) );
@@ -444,7 +451,7 @@
445452 public function emailNotifyUsersOfChanges( $subject, $body ) {
446453 // Give email notices to committer and commenters
447454 global $wgCodeReviewENotif, $wgEnableEmail, $wgCodeReviewCommentWatcherEmail,
448 - $wgCodeReviewCommentWatcherName;
 455+ $wgCodeReviewCommentWatcherName, $wgUser;
449456 if ( !$wgCodeReviewENotif || !$wgEnableEmail ) {
450457 return;
451458 }
@@ -468,6 +475,11 @@
469476 }
470477
471478 foreach ( $users as $id => $user ) {
 479+ // No sense in notifying this commenter
 480+ if ( $wgUser->getId() == $user->getId() ) {
 481+ continue;
 482+ }
 483+
472484 // canReceiveEmail() returns false for the fake watcher user, so exempt it
473485 // This is ugly
474486 if ( $id == 0 || $user->canReceiveEmail() ) {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r83182Revert r77111 due to many people not liking the behaviour....reedy23:54, 3 March 2011
r83184Revert r74967 alsoreedy23:59, 3 March 2011

Status & tagging log