Index: branches/wmf/1.17wmf1/extensions/CodeReview/backend/CodeRevision.php |
— | — | @@ -333,8 +333,10 @@ |
334 | 334 | if ( $wgEnableEmail && $newRevision && count( $affectedRevs ) > 0 ) { |
335 | 335 | // Get committer wiki user name, or repo name at least |
336 | 336 | $commitAuthor = $this->getWikiUser(); |
337 | | - # Author might not have a username in the wiki: |
| 337 | + |
| 338 | + $commitAuthorId = $commitAuthor->getId(); |
338 | 339 | $committer = $commitAuthor ? $commitAuthor->getName() : htmlspecialchars( $this->mAuthor ); |
| 340 | + |
339 | 341 | // Get the authors of these revisions |
340 | 342 | $res = $dbw->select( 'code_rev', |
341 | 343 | array( |
— | — | @@ -369,12 +371,17 @@ |
370 | 372 | $revisionAuthor = $revision->getWikiUser(); |
371 | 373 | |
372 | 374 | //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 ) ) { |
374 | 376 | $users[$revisionAuthor->getId()] = $revisionAuthor; |
375 | 377 | } |
376 | 378 | |
377 | 379 | //Notify commenters and revision author of followup revision |
378 | 380 | 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 | + |
379 | 386 | if ( $user->canReceiveEmail() ) { |
380 | 387 | // Send message in receiver's language |
381 | 388 | $lang = array( 'language' => $user->getOption( 'language' ) ); |
— | — | @@ -444,7 +451,7 @@ |
445 | 452 | public function emailNotifyUsersOfChanges( $subject, $body ) { |
446 | 453 | // Give email notices to committer and commenters |
447 | 454 | global $wgCodeReviewENotif, $wgEnableEmail, $wgCodeReviewCommentWatcherEmail, |
448 | | - $wgCodeReviewCommentWatcherName; |
| 455 | + $wgCodeReviewCommentWatcherName, $wgUser; |
449 | 456 | if ( !$wgCodeReviewENotif || !$wgEnableEmail ) { |
450 | 457 | return; |
451 | 458 | } |
— | — | @@ -468,6 +475,11 @@ |
469 | 476 | } |
470 | 477 | |
471 | 478 | foreach ( $users as $id => $user ) { |
| 479 | + // No sense in notifying this commenter |
| 480 | + if ( $wgUser->getId() == $user->getId() ) { |
| 481 | + continue; |
| 482 | + } |
| 483 | + |
472 | 484 | // canReceiveEmail() returns false for the fake watcher user, so exempt it |
473 | 485 | // This is ugly |
474 | 486 | if ( $id == 0 || $user->canReceiveEmail() ) { |