summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2012-04-11 11:35:06 +0200
committerByron Jones <bjones@mozilla.com>2012-04-11 11:35:06 +0200
commit9ffabb578d4679d90c4733964203fa3e631482e9 (patch)
tree35d7014832c37df25b7a2d028c7b5d0ba13ce99a
parent2cedff64578d719d21d040bf9c44a344b2c1cb20 (diff)
downloadbugzilla-9ffabb578d4679d90c4733964203fa3e631482e9.tar.gz
bugzilla-9ffabb578d4679d90c4733964203fa3e631482e9.tar.xz
Bug 738152: backport product/component email event filter
-rw-r--r--Bugzilla/Constants.pm6
-rw-r--r--Bugzilla/Install/DB.pm9
-rw-r--r--Bugzilla/User.pm6
-rw-r--r--template/en/default/account/prefs/email.html.tmpl2
4 files changed, 16 insertions, 7 deletions
diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm
index 0f979c9f8..3d3d4a41d 100644
--- a/Bugzilla/Constants.pm
+++ b/Bugzilla/Constants.pm
@@ -105,7 +105,7 @@ use Memoize;
POS_EVENTS
EVT_OTHER EVT_ADDED_REMOVED EVT_COMMENT EVT_ATTACHMENT EVT_ATTACHMENT_DATA
EVT_PROJ_MANAGEMENT EVT_OPENED_CLOSED EVT_KEYWORD EVT_CC EVT_DEPEND_BLOCK
- EVT_BUG_CREATED
+ EVT_BUG_CREATED EVT_COMPONENT
NEG_EVENTS
EVT_UNCONFIRMED EVT_CHANGED_BY_ME
@@ -356,11 +356,13 @@ use constant EVT_KEYWORD => 7;
use constant EVT_CC => 8;
use constant EVT_DEPEND_BLOCK => 9;
use constant EVT_BUG_CREATED => 10;
+use constant EVT_COMPONENT => 11;
use constant POS_EVENTS => EVT_OTHER, EVT_ADDED_REMOVED, EVT_COMMENT,
EVT_ATTACHMENT, EVT_ATTACHMENT_DATA,
EVT_PROJ_MANAGEMENT, EVT_OPENED_CLOSED, EVT_KEYWORD,
- EVT_CC, EVT_DEPEND_BLOCK, EVT_BUG_CREATED;
+ EVT_CC, EVT_DEPEND_BLOCK, EVT_BUG_CREATED,
+ EVT_COMPONENT;
use constant EVT_UNCONFIRMED => 50;
use constant EVT_CHANGED_BY_ME => 51;
diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm
index 14425ab40..e89e19647 100644
--- a/Bugzilla/Install/DB.pm
+++ b/Bugzilla/Install/DB.pm
@@ -398,7 +398,7 @@ sub update_table_definitions {
"WHERE initialqacontact = 0");
_migrate_email_prefs_to_new_table();
- _initialize_dependency_tree_changes_email_pref();
+ _initialize_new_email_prefs();
_change_all_mysql_booleans_to_tinyint();
# make classification_id field type be consistent with DB:Schema
@@ -2396,13 +2396,16 @@ sub _migrate_email_prefs_to_new_table {
}
}
-sub _initialize_dependency_tree_changes_email_pref {
+sub _initialize_new_email_prefs {
my $dbh = Bugzilla->dbh;
# Check for any "new" email settings that wouldn't have been ported over
# during the block above. Since these settings would have otherwise
# fallen under EVT_OTHER, we'll just clone those settings. That way if
# folks have already disabled all of that mail, there won't be any change.
- my %events = ("Dependency Tree Changes" => EVT_DEPEND_BLOCK);
+ my %events = (
+ "Dependency Tree Changes" => EVT_DEPEND_BLOCK,
+ "Product/Component Changes" => EVT_COMPONENT,
+ );
foreach my $desc (keys %events) {
my $event = $events{$desc};
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index e9d2754f7..60dbb5f83 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -1643,7 +1643,9 @@ our %names_to_events = (
'attachments.mimetype' => EVT_ATTACHMENT_DATA,
'attachments.ispatch' => EVT_ATTACHMENT_DATA,
'dependson' => EVT_DEPEND_BLOCK,
- 'blocked' => EVT_DEPEND_BLOCK);
+ 'blocked' => EVT_DEPEND_BLOCK,
+ 'product' => EVT_COMPONENT,
+ 'component' => EVT_COMPONENT);
# Returns true if the user wants mail for a given bug change.
# Note: the "+" signs before the constants suppress bareword quoting.
@@ -1662,7 +1664,7 @@ sub wants_bug_mail {
}
else {
# Catch-all for any change not caught by a more specific event
- $events{+EVT_OTHER} = 1;
+ $events{+EVT_OTHER} = 1;
}
# If the user is in a particular role and the value of that role
diff --git a/template/en/default/account/prefs/email.html.tmpl b/template/en/default/account/prefs/email.html.tmpl
index 96a111bae..4f08d51ce 100644
--- a/template/en/default/account/prefs/email.html.tmpl
+++ b/template/en/default/account/prefs/email.html.tmpl
@@ -119,6 +119,8 @@ document.write('<input type="button" value="Disable All Mail" onclick="SetCheckb
description = "A new $terms.bug is created" },
{ id = constants.EVT_OPENED_CLOSED,
description = "The $terms.bug is resolved or reopened" },
+ { id = constants.EVT_COMPONENT,
+ description = "The product or component changes" },
{ id = constants.EVT_PROJ_MANAGEMENT,
description = "The priority, status, severity, or milestone changes" },
{ id = constants.EVT_COMMENT,