New email code wasn't notifying people of changes in state of

dependent bugs.
This commit is contained in:
terry%mozilla.org 2000-01-23 01:03:15 +00:00
parent 4f39a0f977
commit 2bf5e0801c
3 changed files with 87 additions and 17 deletions

View 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.",

View 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();

View File

@ -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) {