diff options
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/BugMail.pm | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm index e35ca35a1..a2501a99c 100644 --- a/Bugzilla/BugMail.pm +++ b/Bugzilla/BugMail.pm @@ -152,6 +152,9 @@ sub Send { push @referenced_bugs, @{ $bug->blocked }; } + # If no changes have been made, there is no need to process further. + return {'sent' => []} unless scalar(@diffs) || scalar(@$comments); + ########################################################################### # Start of email filtering code ########################################################################### @@ -245,7 +248,6 @@ sub Send { # the bug in question. However, we are not necessarily going to mail them # all - there are preferences, permissions checks and all sorts to do yet. my @sent; - my @excluded; # The email client will display the Date: header in the desired timezone, # so we can always use UTC here. @@ -257,18 +259,13 @@ sub Send { foreach my $user_id (keys %recipients) { my %rels_which_want; - my $sent_mail = 0; - $user_cache{$user_id} ||= new Bugzilla::User($user_id); - my $user = $user_cache{$user_id}; + my $user = $user_cache{$user_id} ||= new Bugzilla::User($user_id); # Deleted users must be excluded. next unless $user; # If email notifications are disabled for this account, or the bug # is ignored, there is no need to do additional checks. - if ($user->email_disabled || $user->is_bug_ignored($id)) { - push(@excluded, $user->login); - next; - } + next if ($user->email_disabled || $user->is_bug_ignored($id)); if ($user->can_see_bug($id)) { # Go through each role the user has and see if they want mail in @@ -303,10 +300,7 @@ sub Send { # BMO: never send emails to bugs or .tld addresses. this check needs to # happen after the bugmail_recipients hook. if ($user->email_enabled && $dep_ok && - ($user->login !~ /bugs$/) && - # sync-1@bugzilla.tld here is a temporary hack, see bug 844724 - ($user->login eq 'sync-1@bugzilla.tld' || $user->login !~ /\.tld$/)) - + ($user->login !~ /bugs$/) && ($user->login !~ /\.tld$/)) { # Don't show summaries for bugs the user can't access, and # provide a hook for extensions such as SecureMail to filter @@ -327,8 +321,8 @@ sub Send { { updated_bug => $bug, referenced_bugs => $referenced_bugs }); - $sent_mail = sendMail( - { to => $user, + my $sent_mail = sendMail( + { to => $user, bug => $bug, comments => $comments, date => $date, @@ -339,15 +333,9 @@ sub Send { rels_which_want => \%rels_which_want, referenced_bugs => $referenced_bugs, }); + push(@sent, $user->login) if $sent_mail; } } - - if ($sent_mail) { - push(@sent, $user->login); - } - else { - push(@excluded, $user->login); - } } # When sending bugmail about a blocker being reopened or resolved, @@ -359,7 +347,7 @@ sub Send { $bug->{lastdiffed} = $end; } - return {'sent' => \@sent, 'excluded' => \@excluded}; + return {'sent' => \@sent}; } sub sendMail { |