]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
New email code wasn't notifying people of changes in state of
authorterry%mozilla.org <>
Sun, 23 Jan 2000 09:03:14 +0000 (09:03 +0000)
committerterry%mozilla.org <>
Sun, 23 Jan 2000 09:03:14 +0000 (09:03 +0000)
dependent bugs.

defparams.pl
globals.pl
processmail

index 6ddd1cef0fb4fd880e2e62681795e7301a88e908..daa8c1da2744dbbce42d61fa1a83e7f29f2ee5b1 100644 (file)
@@ -255,6 +255,19 @@ has to then turn on the "New email tech" preference.},
     0);
 
 
+DefParam("newchangedmail",
+q{The same as 'changedmail', but used for the newemailtech stuff.},
+         "l",
+"From: bugzilla-daemon
+To: %to%
+Cc: %cc%
+Subject: [Bug %bugid%] %neworchanged% - %summary%
+
+%urlbase%show_bug.cgi?id=%bugid%
+
+%diffs%");
+
+
 
 DefParam("whinedays",
          "The number of days that we'll let a bug sit untouched in a NEW state before our cronjob will whine at the owner.",
index 8d921f04d319faf5eff7780eba526ba77e73c638..5bc48e754dba0f802b09a68c77057cd081de2df9 100644 (file)
@@ -600,6 +600,19 @@ sub UserInGroup {
 }
 
 
+# Determines if the given bug_status string represents an "Opened" bug.  This
+# routine ought to be paramaterizable somehow, as people tend to introduce
+# new states into Bugzilla.
+
+sub IsOpenedState {
+    my ($state) = (@_);
+    if ($state =~ /^(NEW|REOPENED|ASSIGNED)$/) {
+        return 1;
+    }
+    return 0;
+}
+
+
 sub RemoveVotes {
     my ($id, $reason) = (@_);
     ConnectToDatabase();
index 432ded3e1dd27ea00e6edbb5c1fa60b5e8fbc52a..7441232efe2ccfd0a767c25a86abd938a8f7c2bd 100755 (executable)
@@ -400,6 +400,54 @@ sub NewProcessOneBug {
     $difftext = trim($difftext);
 
 
+    my $deptext = "";
+
+    my $resid = 
+
+    SendSQL("SELECT bugs_activity.bug_id, fielddefs.name, " .
+            "       oldvalue, newvalue " .
+            "FROM bugs_activity, dependencies, fielddefs ".
+            "WHERE bugs_activity.bug_id = dependencies.dependson " .
+            "  AND dependencies.blocked = $id " .
+            "  AND fielddefs.fieldid = bugs_activity.fieldid" .
+            "  AND (fielddefs.name = 'bug_status' " .
+            "    OR fielddefs.name = 'resolution') " .
+            "  AND bug_when > '$start' " .
+            "  AND bug_when <= '$end' " .
+            "ORDER BY bug_when, bug_id");
+    
+    my $thisdiff = "";
+    my $lastbug = "";
+    my $interestingchange = 0;
+    while (MoreSQLData()) {
+        my ($bug, $what, $old, $new) = (FetchSQLData());
+        if ($bug ne $lastbug) {
+            if ($interestingchange) {
+                $deptext .= $thisdiff;
+            }
+            $lastbug = $bug;
+            $thisdiff =
+                "\nThis bug depends on bug $bug, which changed state:\n\n";
+            $thisdiff .= FormatTriple("What    ", "Old Value", "New Value");
+            $thisdiff .= ('-' x 76) . "\n";
+            $interestingchange = 0;
+        }
+        $thisdiff .= FormatTriple($fielddescription{$what}, $old, $new);
+        if ($what eq 'bug_status' && IsOpenedState($old) ne IsOpenedState($new)) {
+            $interestingchange = 1;
+        }
+    }
+    if ($interestingchange) {
+        $deptext .= $thisdiff;
+    }
+
+    $deptext = trim($deptext);
+
+    if ($deptext) {
+        $difftext = trim($difftext . "\n\n" . $deptext);
+    }
+
+
     my $newcomments = GetLongDescription($id, $start, $end);
 
     my $count = 0;
@@ -451,6 +499,7 @@ sub NewProcessOneBug {
 #              }
 #          }
 
+
         my $head = "";
         
         foreach my $f (@headerlist) {
@@ -484,6 +533,9 @@ sub NewProcessOneBug {
 #                  }
             }
         }
+
+        
+
         if ($difftext eq "" && $newcomments eq "") {
             # Whoops, no differences!
             next;
@@ -503,21 +555,13 @@ sub NewProcessOneBug {
         }
         $substs{"summary"} = $values{'short_desc'};
         
-        # my $template = Param("changedmail");
-        my $template = "From: bugzilla-daemon
-To: %to%
-Cc: %cc%
-Subject: [Bug %bugid%] %neworchanged% - %summary%
+        my $template = Param("newchangedmail");
 
-%urlbase%show_bug.cgi?id=%bugid%
-
-%diffs%";
-
-        my $msg = PerformSubsts(Param("changedmail"), \%substs);
+        my $msg = PerformSubsts($template, \%substs);
         open(SENDMAIL, "|/usr/lib/sendmail -t") ||
             die "Can't open sendmail";
         
-        print SENDMAIL trim($msg);
+        print SENDMAIL trim($msg) . "\n";
         close SENDMAIL;
         push(@sentlist, $person);
     }
@@ -598,16 +642,16 @@ sub ProcessOneBug {
 
                 $logstr = "$logstr; mail sent to $tolist, $cclist";
             }
-            if (@sentlist) {
-                print "<B>Email sent to:</B> " . join(", ", @sentlist) . "\n";
-                if ($didexclude) {
-                    print "<B>Excluding:</B> $nametoexclude (<a href=changepassword.cgi>change your preferences</a> if you wish not to be excluded)\n";
-                }
-            }
         }
         unlink($diffs);
         Log($logstr);
     }
+    if (@sentlist) {
+        print "<B>Email sent to:</B> " . join(", ", @sentlist) . "\n";
+        if ($didexclude) {
+            print "<B>Excluding:</B> $nametoexclude (<a href=changepassword.cgi>change your preferences</a> if you wish not to be excluded)\n";
+        }
+    }
     rename($new, $old) || die "Can't rename $new to $old";
     chmod 0666, $old;
     if ($regenerate) {