}
# Global watcher
- my @watchers = split(/[,\s]+/, Bugzilla->params->{'globalwatchers'});
+ my @watchers = split(/\s*,\s*/ms, Bugzilla->params->{'globalwatchers'});
foreach (@watchers) {
my $watcher_id = login_to_id($_);
next unless $watcher_id;
my $self = shift;
my ($bug, $relationship, $fieldDiffs, $comments, $dep_mail, $changer) = @_;
+ # is_silent_user is true if the username is mentioned in the param `silent_users`
+ return 0 if $changer && $changer->is_silent_user;
+
# Make a list of the events which have happened during this bug change,
# from the point of view of this user.
my %events;
sub is_global_watcher {
my $self = shift;
- if (!defined $self->{'is_global_watcher'}) {
- my @watchers = split(/[,;]+/, Bugzilla->params->{'globalwatchers'});
- $self->{'is_global_watcher'} = scalar(grep { $_ eq $self->login } @watchers) ? 1 : 0;
+ if (!exists $self->{'is_global_watcher'}) {
+ my @watchers = split(/\s*,\s*/, Bugzilla->params->{'globalwatchers'});
+ $self->{'is_global_watcher'} = (any { $_ eq $self->login } @watchers) ? 1 : 0;
}
return $self->{'is_global_watcher'};
}
+sub is_silent_user {
+ my $self = shift;
+
+ if (!exists $self->{'is_silent_user'}) {
+ my @users = split(/\s*,\s*/, Bugzilla->params->{'silent_users'});
+ $self->{'is_silent_user'} = (any { $self->login eq $_ } @users) ? 1 : 0;
+ }
+
+ return $self->{'is_silent_user'};
+}
+
sub is_timetracker {
my $self = shift;
"Set to 0 to disable whining.",
globalwatchers => "A comma-separated list of users who should receive a " _
- "copy of every notification mail the system sends." }
+ "copy of every notification mail the system sends.",
+
+ silent_users => "A comma-separated list of users who never trigger sending email." }
%]