# We need these strings for the X-Bugzilla-Reasons header
# Note: this hash uses "," rather than "=>" to avoid auto-quoting of the LHS.
use constant REL_NAMES => {
- REL_ASSIGNEE, "AssignedTo",
- REL_REPORTER, "Reporter",
- REL_QA , "QAcontact",
- REL_CC , "CC",
- REL_VOTER , "Voter"
+ REL_ASSIGNEE , "AssignedTo",
+ REL_REPORTER , "Reporter",
+ REL_QA , "QAcontact",
+ REL_CC , "CC",
+ REL_VOTER , "Voter",
+ REL_GLOBAL_WATCHER, "GlobalWatcher"
};
sub FormatTriple {
push (@{$watching{$watch->[0]}}, $watch->[1]);
}
}
-
+
+ # Global watcher
+ my @watchers = split(/[,\s]+/, Bugzilla->params->{'globalwatchers'});
+ foreach (@watchers) {
+ my $watcher_id = login_to_id($_);
+ next unless $watcher_id;
+ $recipients{$watcher_id}->{+REL_GLOBAL_WATCHER} = BIT_DIRECT;
+ }
+
# We now have a complete set of all the users, and their relationships to
# 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.
type => 't',
default => 7,
checker => \&check_numeric
- } );
+ },
+
+ {
+ name => 'globalwatchers',
+ type => 't',
+ default => '',
+ }, );
return @param_list;
}
THROW_ERROR
RELATIONSHIPS
- REL_ASSIGNEE REL_QA REL_REPORTER REL_CC REL_VOTER
+ REL_ASSIGNEE REL_QA REL_REPORTER REL_CC REL_VOTER REL_GLOBAL_WATCHER
REL_ANY
POS_EVENTS
use constant REL_REPORTER => 2;
use constant REL_CC => 3;
use constant REL_VOTER => 4;
+use constant REL_GLOBAL_WATCHER => 5;
use constant RELATIONSHIPS => REL_ASSIGNEE, REL_QA, REL_REPORTER, REL_CC,
- REL_VOTER;
+ REL_VOTER, REL_GLOBAL_WATCHER;
# Used for global events like EVT_FLAG_REQUESTED
use constant REL_ANY => 100;
# No mail if there are no events
return 0 if !scalar(@$events);
+
+ # Skip DB query if relationship is explicit
+ return 1 if $relationship == REL_GLOBAL_WATCHER;
my $dbh = Bugzilla->dbh;
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>
+ globalwatcher
+ </term>
+ <listitem>
+ <para>
+ This allows to define specific users that will
+ receive notification each time a new bug in entered, or when
+ an existing bug changes, according to the normal groupset
+ permissions. It may be useful for sending notifications to a
+ mailing-list, for instance.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term>
usestatuswhiteboard
use Bugzilla::Util;
use Bugzilla::Error;
use Bugzilla::Token;
+use Bugzilla::User;
my $user = Bugzilla->login(LOGIN_REQUIRED);
my $cgi = Bugzilla->cgi;
if ($ok ne "") {
ThrowUserError('invalid_parameter', { name => $name, err => $ok });
}
+ } elsif ($name eq 'globalwatchers') {
+ # can't check this as others, as Bugzilla::Config::Common
+ # can not use Bugzilla::User
+ foreach my $watcher (split(/[,\s]+/, $value)) {
+ ThrowUserError(
+ 'invalid_parameter',
+ { name => $name, err => "no such user $watcher" }
+ ) unless login_to_id($watcher);
+ }
}
push(@changes, $name);
SetParam($name, $value);
whinedays => "The number of days that we'll let a $terms.bug sit untouched in a NEW " _
"state before our cronjob will whine at the owner.<br> " _
- "Set to 0 to disable whining." }
+ "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." }
%]
You are on the CC list for the [% terms.bug %].
[% CASE constants.REL_VOTER %]
You are a voter for the [% terms.bug %].
+ [% CASE constants.REL_GLOBAL_WATCHER %]
+You are watching all [% terms.bug %] changes.
[% END %]
[% END %]
[% FOREACH relationship = reasons_watch %]