aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@netscape.net>2017-04-19 19:30:03 +0200
committerFrédéric Buclin <LpSolit@netscape.net>2017-04-19 19:30:03 +0200
commitcf3fa62685f06f0325ef6cd0a700c278deba029f (patch)
treee2cd2b12aa455fbc0173455b16851e27e9e353d9
parentb177f09048eb2da61fe0dae35e46df66d9f34fbb (diff)
downloadbugs-cf3fa62685f06f0325ef6cd0a700c278deba029f.tar
bugs-cf3fa62685f06f0325ef6cd0a700c278deba029f.tar.gz
bugs-cf3fa62685f06f0325ef6cd0a700c278deba029f.tar.bz2
bugs-cf3fa62685f06f0325ef6cd0a700c278deba029f.tar.xz
bugs-cf3fa62685f06f0325ef6cd0a700c278deba029f.zip
Do not email global watchers if the single change is about the CC list (mga#13379)
-rw-r--r--Bugzilla/User.pm8
-rw-r--r--extensions/Mageia/Extension.pm11
2 files changed, 18 insertions, 1 deletions
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index 77e6cebb0..1768d7c48 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -2132,10 +2132,16 @@ sub wants_mail {
$relationship = REL_ANY;
}
+ my $wants_mail;
+ Bugzilla::Hook::process('user_wants_mail', { events => $events,
+ relationship => $relationship,
+ wants_mail => \$wants_mail });
+ return $wants_mail if defined $wants_mail;
+
# Skip DB query if relationship is explicit
return 1 if $relationship == REL_GLOBAL_WATCHER;
- my $wants_mail = grep { $self->mail_settings->{$relationship}{$_} } @$events;
+ $wants_mail = grep { $self->mail_settings->{$relationship}{$_} } @$events;
return $wants_mail ? 1 : 0;
}
diff --git a/extensions/Mageia/Extension.pm b/extensions/Mageia/Extension.pm
index 19d579c63..819838b95 100644
--- a/extensions/Mageia/Extension.pm
+++ b/extensions/Mageia/Extension.pm
@@ -13,6 +13,7 @@ use warnings;
use parent qw(Bugzilla::Extension);
+use Bugzilla::Constants qw(EVT_CC REL_GLOBAL_WATCHER);
use Bugzilla::Bug qw(LogActivityEntry);
use Bugzilla::Field qw(get_field_id);
use Bugzilla::User qw();
@@ -117,4 +118,14 @@ sub mailer_before_send {
}
}
+sub user_wants_mail {
+ my ($self, $args) = @_;
+ return unless $args->{relationship} == REL_GLOBAL_WATCHER;
+
+ my $wants_mail = $args->{wants_mail};
+ my @events = @{ $args->{events} };
+ # Do not email global watchers if the single change is about the CC list.
+ $$wants_mail = (scalar(@events) == 1 && $events[0] == EVT_CC) ? 0 : 1;
+}
+
__PACKAGE__->NAME;