Index: trunk/extensions/CodeReview/backend/CodeRevision.php |
— | — | @@ -309,7 +309,8 @@ |
310 | 310 | if ( $wgEnableEmail && $newRevision && count( $affectedRevs ) > 0 ) { |
311 | 311 | // Get committer wiki user name, or repo name at least |
312 | 312 | $commitAuthor = $this->getWikiUser(); |
313 | | - $commitAuthorId = $commitAuthor->getId(); |
| 313 | + # Author might not have a username in the wiki: |
| 314 | + $commitAuthorId = $commitAuthor ? $commitAuthor->getId() : false; |
314 | 315 | $committer = $commitAuthor ? $commitAuthor->getName() : htmlspecialchars( $this->mAuthor ); |
315 | 316 | // Get the authors of these revisions |
316 | 317 | $res = $dbw->select( 'code_rev', |
— | — | @@ -345,15 +346,18 @@ |
346 | 347 | $revisionAuthor = $revision->getWikiUser(); |
347 | 348 | |
348 | 349 | //Add the followup revision author if they have not already been added as a commentor (they won't want dupe emails!) |
349 | | - if ( !array_key_exists( $revisionAuthor->getId(), $users ) ) { |
| 350 | + if ( $revisionAuthor && !array_key_exists( $revisionAuthor->getId(), $users ) ) { |
350 | 351 | $users[$revisionAuthor->getId()] = $revisionAuthor; |
351 | 352 | } |
352 | 353 | |
353 | 354 | //Notify commenters and revision author of followup revision |
354 | 355 | foreach ( $users as $userId => $user ) { |
355 | | - // No sense in notifying the author of this rev if they are a commenter/the author on the target rev |
| 356 | + // Notify user with its own message if he already want |
| 357 | + // to be CCed of all emails it sends. |
356 | 358 | if ( $commitAuthorId == $user->getId() ) { |
357 | | - continue; |
| 359 | + if(! $user->getBoolOption( 'ccmeonemails' ) ) { |
| 360 | + continue; |
| 361 | + } |
358 | 362 | } |
359 | 363 | |
360 | 364 | if ( $user->canReceiveEmail() ) { |
— | — | @@ -427,9 +431,12 @@ |
428 | 432 | $url = $this->getFullUrl( $commentId ); |
429 | 433 | |
430 | 434 | foreach ( $users as $userId => $user ) { |
431 | | - // No sense in notifying this commenter |
| 435 | + // Notify user with its own message if he already want |
| 436 | + // to be CCed of all emails it sends. |
432 | 437 | if ( $wgUser->getId() == $user->getId() ) { |
433 | | - continue; |
| 438 | + if(! $user->getBoolOption( 'ccmeonemails' ) ) { |
| 439 | + continue; |
| 440 | + } |
434 | 441 | } |
435 | 442 | |
436 | 443 | if ( $user->canReceiveEmail() ) { |