summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorolav%bkor.dhs.org <>2006-11-14 08:32:28 +0100
committerolav%bkor.dhs.org <>2006-11-14 08:32:28 +0100
commit410641ccf4ed887b3988222678704a8c5569002d (patch)
treee698db3e6bb515c2a51359c13a11918a6b83210f
parentf1c83b410cd23c14e74a4a43f64632c050008dd7 (diff)
downloadbugzilla-410641ccf4ed887b3988222678704a8c5569002d.tar.gz
bugzilla-410641ccf4ed887b3988222678704a8c5569002d.tar.xz
Bug 277370: Ability to specify an email address to which notification about all bugs should go
Patch by Guillaume Rousse <guillomovitch@zarb.org> r=bkor a=myk
-rw-r--r--Bugzilla/BugMail.pm21
-rw-r--r--Bugzilla/Config/MTA.pm8
-rw-r--r--Bugzilla/Constants.pm5
-rw-r--r--Bugzilla/User.pm3
-rw-r--r--docs/xml/administration.xml15
-rwxr-xr-xeditparams.cgi10
-rw-r--r--template/en/default/admin/params/mta.html.tmpl5
-rw-r--r--template/en/default/email/newchangedmail.txt.tmpl2
8 files changed, 59 insertions, 10 deletions
diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm
index f5ad7c095..9a83b1cd3 100644
--- a/Bugzilla/BugMail.pm
+++ b/Bugzilla/BugMail.pm
@@ -50,11 +50,12 @@ use constant BIT_WATCHING => 2;
# 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 {
@@ -392,7 +393,15 @@ sub Send {
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.
diff --git a/Bugzilla/Config/MTA.pm b/Bugzilla/Config/MTA.pm
index a9bc4619c..27d03462a 100644
--- a/Bugzilla/Config/MTA.pm
+++ b/Bugzilla/Config/MTA.pm
@@ -72,7 +72,13 @@ sub get_param_list {
type => 't',
default => 7,
checker => \&check_numeric
- } );
+ },
+
+ {
+ name => 'globalwatchers',
+ type => 't',
+ default => '',
+ }, );
return @param_list;
}
diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm
index 9c2cf77b4..ec1467136 100644
--- a/Bugzilla/Constants.pm
+++ b/Bugzilla/Constants.pm
@@ -85,7 +85,7 @@ use File::Basename;
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
@@ -244,9 +244,10 @@ use constant REL_QA => 1;
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;
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index ff61034dd..3c18f1908 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -1460,6 +1460,9 @@ sub wants_mail {
# 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;
diff --git a/docs/xml/administration.xml b/docs/xml/administration.xml
index 17ffacc44..f22523026 100644
--- a/docs/xml/administration.xml
+++ b/docs/xml/administration.xml
@@ -198,6 +198,21 @@
<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
</term>
<listitem>
diff --git a/editparams.cgi b/editparams.cgi
index cbce6405f..80b458d90 100755
--- a/editparams.cgi
+++ b/editparams.cgi
@@ -32,6 +32,7 @@ use Bugzilla::Config::Common;
use Bugzilla::Util;
use Bugzilla::Error;
use Bugzilla::Token;
+use Bugzilla::User;
my $user = Bugzilla->login(LOGIN_REQUIRED);
my $cgi = Bugzilla->cgi;
@@ -116,6 +117,15 @@ if ($action eq 'save' && $current_module) {
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);
diff --git a/template/en/default/admin/params/mta.html.tmpl b/template/en/default/admin/params/mta.html.tmpl
index 224d21544..778f81d0a 100644
--- a/template/en/default/admin/params/mta.html.tmpl
+++ b/template/en/default/admin/params/mta.html.tmpl
@@ -58,6 +58,9 @@
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." }
%]
diff --git a/template/en/default/email/newchangedmail.txt.tmpl b/template/en/default/email/newchangedmail.txt.tmpl
index ad7d564b4..d9962496b 100644
--- a/template/en/default/email/newchangedmail.txt.tmpl
+++ b/template/en/default/email/newchangedmail.txt.tmpl
@@ -57,6 +57,8 @@ You are the QA contact for the [% terms.bug %].
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 %]