Commit b29f60f6 authored by Frédéric Buclin's avatar Frédéric Buclin

Bug 396558: Dependency change e-mails should only include status changes that happened right now

r/a=mkanat
parent 457f46da
......@@ -1154,14 +1154,22 @@ sub send_changes {
# If there were changes in dependencies, we need to notify those
# dependencies.
my %notify_deps;
if ($changes->{'bug_status'}) {
my ($old_status, $new_status) = @{ $changes->{'bug_status'} };
# If this bug has changed from opened to closed or vice-versa,
# then all of the bugs we block need to be notified.
if (is_open_state($old_status) ne is_open_state($new_status)) {
$notify_deps{$_} = 1 foreach (@{ $self->blocked });
my $params = { forced => { changer => $user },
type => 'dep',
dep_only => 1,
blocker => $self,
changes => $changes };
foreach my $id (@{ $self->blocked }) {
$params->{id} = $id;
_send_bugmail($params, $vars);
}
}
}
......@@ -1177,8 +1185,7 @@ sub send_changes {
# an error later.
delete $changed_deps{''};
my %all_dep_changes = (%notify_deps, %changed_deps);
foreach my $id (sort { $a <=> $b } (keys %all_dep_changes)) {
foreach my $id (sort { $a <=> $b } (keys %changed_deps)) {
_send_bugmail({ forced => { changer => $user }, type => "dep",
id => $id }, $vars);
}
......@@ -1188,7 +1195,7 @@ sub _send_bugmail {
my ($params, $vars) = @_;
my $results =
Bugzilla::BugMail::Send($params->{'id'}, $params->{'forced'});
Bugzilla::BugMail::Send($params->{'id'}, $params->{'forced'}, $params);
if (Bugzilla->usage_mode == USAGE_MODE_BROWSER) {
my $template = Bugzilla->template;
......
......@@ -1513,7 +1513,7 @@ our %names_to_events = (
# Note: the "+" signs before the constants suppress bareword quoting.
sub wants_bug_mail {
my $self = shift;
my ($bug_id, $relationship, $fieldDiffs, $comments, $dependencyText,
my ($bug_id, $relationship, $fieldDiffs, $comments, $dep_mail,
$changer, $bug_is_new) = @_;
# Make a list of the events which have happened during this bug change,
......@@ -1572,7 +1572,7 @@ sub wants_bug_mail {
# Dependent changed bugmails must have an event to ensure the bugmail is
# emailed.
if ($dependencyText ne '') {
if ($dep_mail) {
$events{+EVT_DEPEND_BLOCK} = 1;
}
......
......@@ -24,7 +24,7 @@
From: [% Param('mailfrom') %]
To: [% to_user.email %]
Subject: [[% terms.Bug %] [%+ bug.id %]] [% 'New: ' IF isnew %][%+ bug.short_desc %]
Date: [% bug.delta_ts FILTER time("%a, %d %b %Y %T %z", to_user.timezone) %]
Date: [% delta_ts || bug.delta_ts FILTER time("%a, %d %b %Y %T %z", to_user.timezone) %]
X-Bugzilla-Reason: [% reasonsheader %]
X-Bugzilla-Type: [% isnew ? 'new' : 'changed' %]
X-Bugzilla-Watch-Reason: [% reasonswatchheader %]
......
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