summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--defparams.pl13
-rw-r--r--globals.pl13
-rwxr-xr-xprocessmail78
3 files changed, 87 insertions, 17 deletions
diff --git a/defparams.pl b/defparams.pl
index 6ddd1cef0..daa8c1da2 100644
--- a/defparams.pl
+++ b/defparams.pl
@@ -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.",
diff --git a/globals.pl b/globals.pl
index 8d921f04d..5bc48e754 100644
--- a/globals.pl
+++ b/globals.pl
@@ -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();
diff --git a/processmail b/processmail
index 432ded3e1..7441232ef 100755
--- a/processmail
+++ b/processmail
@@ -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) {