Fix for bug 99608: dependency mails are no longer sent if the dependent bug can't be seen by the would-be recipient of the email.

Patch by Jake Steenhagen and David Kilzer
r= gerv, justdave
This commit is contained in:
justdave%syndicomm.com 2002-01-16 03:25:52 +00:00
Родитель b19e5537e9
Коммит 5ff55b992b
1 изменённых файлов: 28 добавлений и 10 удалений

Просмотреть файл

@ -187,18 +187,21 @@ sub ProcessOneBug {
my $thisdiff = ""; my $thisdiff = "";
my $lastbug = ""; my $lastbug = "";
my $interestingchange = 0; my $interestingchange = 0;
my $depbug = 0;
my @depbugs;
while (MoreSQLData()) { while (MoreSQLData()) {
my ($bug, $summary, $what, $old, $new) = (FetchSQLData()); my ($summary, $what, $old, $new);
if ($bug ne $lastbug) { ($depbug, $summary, $what, $old, $new) = (FetchSQLData());
if ($depbug ne $lastbug) {
if ($interestingchange) { if ($interestingchange) {
$deptext .= $thisdiff; $deptext .= $thisdiff;
} }
$lastbug = $bug; $lastbug = $depbug;
my $urlbase = Param("urlbase"); my $urlbase = Param("urlbase");
$thisdiff = $thisdiff =
"\nBug $id depends on bug $bug, which changed state.\n\n" . "\nBug $id depends on bug $depbug, which changed state.\n\n" .
"Bug $bug Summary: $summary\n" . "Bug $depbug Summary: $summary\n" .
"${urlbase}show_bug.cgi?id=$bug\n\n"; "${urlbase}show_bug.cgi?id=$depbug\n\n";
$thisdiff .= FormatTriple("What ", "Old Value", "New Value"); $thisdiff .= FormatTriple("What ", "Old Value", "New Value");
$thisdiff .= ('-' x 76) . "\n"; $thisdiff .= ('-' x 76) . "\n";
$interestingchange = 0; $interestingchange = 0;
@ -207,7 +210,10 @@ sub ProcessOneBug {
if ($what eq 'bug_status' && IsOpenedState($old) ne IsOpenedState($new)) { if ($what eq 'bug_status' && IsOpenedState($old) ne IsOpenedState($new)) {
$interestingchange = 1; $interestingchange = 1;
} }
push(@depbugs, $depbug);
} }
if ($interestingchange) { if ($interestingchange) {
$deptext .= $thisdiff; $deptext .= $thisdiff;
} }
@ -290,7 +296,9 @@ sub ProcessOneBug {
\@reasons, \%values, \@reasons, \%values,
\%defmailhead, \%defmailhead,
\%fielddescription, $difftext, \%fielddescription, $difftext,
$newcomments, $start, $id))) { $newcomments, $start, $id,
\@depbugs)))
{
# if a value is not returned, this means that the person # if a value is not returned, this means that the person
# was not sent mail. add them to the excludedAddresses list. # was not sent mail. add them to the excludedAddresses list.
@ -628,15 +636,16 @@ sub filterEmailGroup ($$$) {
return @filteredList; return @filteredList;
} }
sub NewProcessOnePerson ($$$$$$$$$$$) { sub NewProcessOnePerson ($$$$$$$$$$$$) {
my ($person, $count, $hlRef, $reasonsRef, $valueRef, $dmhRef, $fdRef, $difftext, my ($person, $count, $hlRef, $reasonsRef, $valueRef, $dmhRef, $fdRef, $difftext,
$newcomments, $start, $id) = @_; $newcomments, $start, $id, $depbugsRef) = @_;
my %values = %$valueRef; my %values = %$valueRef;
my @headerlist = @$hlRef; my @headerlist = @$hlRef;
my @reasons = @$reasonsRef; my @reasons = @$reasonsRef;
my %defmailhead = %$dmhRef; my %defmailhead = %$dmhRef;
my %fielddescription = %$fdRef; my %fielddescription = %$fdRef;
my @depbugs = @$depbugsRef;
if ($seen{$person}) { if ($seen{$person}) {
return; return;
@ -666,6 +675,15 @@ sub NewProcessOnePerson ($$$$$$$$$$$) {
# #
return unless CanSeeBug($id, $userid, $groupset); return unless CanSeeBug($id, $userid, $groupset);
# We shouldn't send changedmail if this is a dependency mail, and any of
# the depending bugs is not visible to the user.
foreach my $dep_id (@depbugs) {
my $save_id = $dep_id;
detaint_natural($dep_id) || warn("Unexpected Error: \@depbugs contains a non-numeric value: '$save_id'")
&& return;
return unless CanSeeBug($dep_id, $userid, $groupset);
}
my %mailhead = %defmailhead; my %mailhead = %defmailhead;
my $head = ""; my $head = "";