Commit 9a5f5918 authored by Damien Nozay's avatar Damien Nozay Committed by Dave Lawrence

Bug 904467 - error when %recipients is empty (e.g. after bugmail_recipients empties it)

r/a=glob
parent cf84d586
...@@ -186,21 +186,24 @@ sub Send { ...@@ -186,21 +186,24 @@ sub Send {
{ bug => $bug, recipients => \%recipients, { bug => $bug, recipients => \%recipients,
users => \%user_cache, diffs => \@diffs }); users => \%user_cache, diffs => \@diffs });
# Find all those user-watching anyone on the current list, who is not # We should not assume %recipients to have any entries.
# on it already themselves. if (scalar keys %recipients) {
my $involved = join(",", keys %recipients); # Find all those user-watching anyone on the current list, who is not
# on it already themselves.
my $userwatchers = my $involved = join(",", keys %recipients);
$dbh->selectall_arrayref("SELECT watcher, watched FROM watch
WHERE watched IN ($involved)"); my $userwatchers =
$dbh->selectall_arrayref("SELECT watcher, watched FROM watch
# Mark these people as having the role of the person they are watching WHERE watched IN ($involved)");
foreach my $watch (@$userwatchers) {
while (my ($role, $bits) = each %{$recipients{$watch->[1]}}) { # Mark these people as having the role of the person they are watching
$recipients{$watch->[0]}->{$role} |= BIT_WATCHING foreach my $watch (@$userwatchers) {
if $bits & BIT_DIRECT; while (my ($role, $bits) = each %{$recipients{$watch->[1]}}) {
$recipients{$watch->[0]}->{$role} |= BIT_WATCHING
if $bits & BIT_DIRECT;
}
push(@{$watching{$watch->[0]}}, $watch->[1]);
} }
push(@{$watching{$watch->[0]}}, $watch->[1]);
} }
# Global watcher # Global watcher
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment