aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;