]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 314269: Add email pref to not send mail about dependency changes - Patch by Todd...
authorlpsolit%gmail.com <>
Tue, 1 Nov 2005 07:09:28 +0000 (07:09 +0000)
committerlpsolit%gmail.com <>
Tue, 1 Nov 2005 07:09:28 +0000 (07:09 +0000)
Bugzilla/Constants.pm
Bugzilla/User.pm
checksetup.pl
template/en/default/account/prefs/email.html.tmpl

index 7411ca0b0408a2994d97c06c528a24c1c9466484..09717486ee6bd6f720885456035a13f08727cc75 100644 (file)
@@ -78,7 +78,7 @@ use base qw(Exporter);
     
     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_PROJ_MANAGEMENT EVT_OPENED_CLOSED EVT_KEYWORD EVT_CC EVT_DEPEND_BLOCK
     
     NEG_EVENTS
     EVT_UNCONFIRMED EVT_CHANGED_BY_ME 
@@ -214,11 +214,12 @@ use constant EVT_PROJ_MANAGEMENT    => 5;
 use constant EVT_OPENED_CLOSED      => 6;
 use constant EVT_KEYWORD            => 7;
 use constant EVT_CC                 => 8;
+use constant EVT_DEPEND_BLOCK       => 9;
 
 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_CC, EVT_DEPEND_BLOCK;
 
 use constant EVT_UNCONFIRMED        => 50;
 use constant EVT_CHANGED_BY_ME      => 51;
index 6beb16a8b2e82d618e8278359ac0f7431158e400..701c1c2b229f00001a2c6b1780005d1582db4130 100644 (file)
@@ -1085,7 +1085,9 @@ our %names_to_events = (
     'Target Milestone'       => EVT_PROJ_MANAGEMENT,
     'Attachment description' => EVT_ATTACHMENT_DATA,
     'Attachment mime type'   => EVT_ATTACHMENT_DATA,
-    'Attachment is patch'    => EVT_ATTACHMENT_DATA);
+    'Attachment is patch'    => EVT_ATTACHMENT_DATA,
+    'BugsThisDependsOn'      => EVT_DEPEND_BLOCK,
+    'OtherBugsDependingOnThis' => EVT_DEPEND_BLOCK);
 
 # Returns true if the user wants mail for a given bug change.
 # Note: the "+" signs before the constants suppress bareword quoting.
index c728c46367cc01cbc0030279d09159af79cb0e41..84c94f10811c1640ccf87d3b4f2f55dddaa6ae89 100755 (executable)
@@ -3890,6 +3890,26 @@ if ($dbh->bz_column_info("profiles", "emailflags")) {
     $dbh->bz_drop_column("profiles", "emailflags");    
 }
 
+# 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); 
+
+    foreach my $desc (keys %events) {
+        my $event = $events{$desc};
+        $sth = $dbh->prepare("SELECT count(*) FROM email_setting WHERE event = $event");
+        $sth->execute();
+        if (!($sth->fetchrow_arrayref()->[0])) {
+            # No settings in the table yet, so we assume that this is the
+            # first time it's being set.
+            print "Initializing \"$desc\" email_setting ...\n" unless $silent;
+            CloneEmailEvent(EVT_OTHER, $event);
+        }
+    }
+}
+
 sub CloneEmailEvent {
     my ($source, $target) = @_;
 
index 2c75a085c9ad63e77104e60e78f75d6f9bd82e49..8579992008bf0d0633e9a995fa1307e4f4a9730d 100644 (file)
@@ -124,6 +124,8 @@ document.write('<input type="button" value="Disable All Mail" onclick="SetCheckb
       description = "The keywords field changes" },
     { id = constants.EVT_CC,
       description = "The CC field changes" },
+    { id = constants.EVT_DEPEND_BLOCK,
+      description = "The dependency tree changes" },
     { id = constants.EVT_OTHER,
       description = "Any field not mentioned above changes" },
 ] %]