Commit 17b7781c authored by Simon Green's avatar Simon Green

Bug 97956 - Give summary and URL of bugs added or removed from dependencies in bugmail

r=LpSolit, a=sgreen
parent 1cf4971f
...@@ -118,6 +118,9 @@ sub Send { ...@@ -118,6 +118,9 @@ sub Send {
my %recipients; my %recipients;
my %watching; my %watching;
# We also record bugs that are referenced
my @referenced_bug_ids = ();
# Now we work out all the people involved with this bug, and note all of # Now we work out all the people involved with this bug, and note all of
# the relationships in a hash. The keys are userids, the values are an # the relationships in a hash. The keys are userids, the values are an
# array of role constants. # array of role constants.
...@@ -161,8 +164,17 @@ sub Send { ...@@ -161,8 +164,17 @@ sub Send {
$recipients{$uid}->{+REL_ASSIGNEE} = BIT_DIRECT if $uid; $recipients{$uid}->{+REL_ASSIGNEE} = BIT_DIRECT if $uid;
} }
} }
if ($change->{field_name} eq 'dependson' || $change->{field_name} eq 'blocked') {
push @referenced_bug_ids, split(/[\s,]+/, $change->{old});
push @referenced_bug_ids, split(/[\s,]+/, $change->{new});
}
} }
my $referenced_bugs = scalar(@referenced_bug_ids)
? Bugzilla::Bug->new_from_list([uniq @referenced_bug_ids])
: [];
# Make sure %user_cache has every user in it so far referenced # Make sure %user_cache has every user in it so far referenced
foreach my $user_id (keys %recipients) { foreach my $user_id (keys %recipients) {
$user_cache{$user_id} ||= new Bugzilla::User($user_id); $user_cache{$user_id} ||= new Bugzilla::User($user_id);
...@@ -258,7 +270,8 @@ sub Send { ...@@ -258,7 +270,8 @@ sub Send {
$watching{$user_id} : undef, $watching{$user_id} : undef,
diffs => \@diffs, diffs => \@diffs,
rels_which_want => \%rels_which_want, rels_which_want => \%rels_which_want,
dep_only => $params->{dep_only} dep_only => $params->{dep_only},
referenced_bugs => $referenced_bugs,
}); });
push(@sent, $user->login) if $sent_mail; push(@sent, $user->login) if $sent_mail;
} }
...@@ -289,6 +302,7 @@ sub sendMail { ...@@ -289,6 +302,7 @@ sub sendMail {
my @diffs = @{ $params->{diffs} }; my @diffs = @{ $params->{diffs} };
my $relRef = $params->{rels_which_want}; my $relRef = $params->{rels_which_want};
my $dep_only = $params->{dep_only}; my $dep_only = $params->{dep_only};
my $referenced_bugs = $params->{referenced_bugs};
# Only display changes the user is allowed see. # Only display changes the user is allowed see.
my @display_diffs; my @display_diffs;
...@@ -350,6 +364,7 @@ sub sendMail { ...@@ -350,6 +364,7 @@ sub sendMail {
changer => $changer, changer => $changer,
diffs => \@display_diffs, diffs => \@display_diffs,
changedfields => \@changedfields, changedfields => \@changedfields,
referenced_bugs => $user->visible_bugs($referenced_bugs),
new_comments => \@send_comments, new_comments => \@send_comments,
threadingmarker => build_thread_marker($bug->id, $user->id, !$bug->lastdiffed), threadingmarker => build_thread_marker($bug->id, $user->id, !$bug->lastdiffed),
bugmailtype => $bugmailtype, bugmailtype => $bugmailtype,
......
...@@ -29,6 +29,23 @@ ...@@ -29,6 +29,23 @@
</div> </div>
[% END %] [% END %]
</p> </p>
[% IF referenced_bugs.size %]
<div id="referenced">
<hr style="border: 1px dashed #969696">
<b>Referenced [% terms.Bugs %]:</b>
<ul>
[% FOREACH ref_bug = referenced_bugs %]
<li>
[[% "${terms.Bug} ${ref_bug.id}" FILTER bug_link(ref_bug, {full_url => 1, user => to_user}) FILTER none %]]
[% ref_bug.short_desc FILTER html %]
</li>
[% END %]
</ul>
</div>
<br>
[% END %]
<hr> <hr>
<span>You are receiving this mail because:</span> <span>You are receiving this mail because:</span>
......
...@@ -22,6 +22,15 @@ ...@@ -22,6 +22,15 @@
[%+ comment.body_full({ is_bugmail => 1, wrap => 1 }) %] [%+ comment.body_full({ is_bugmail => 1, wrap => 1 }) %]
[% END %] [% END %]
[% IF referenced_bugs.size %]
Referenced [% terms.Bugs %]:
[% FOREACH ref_bug = referenced_bugs %]
[%+ urlbase %]show_bug.cgi?id=[% ref_bug.id %]
[%+ "[" _ terms.Bug _ " " _ ref_bug.id _ "] " _ ref_bug.short_desc FILTER wrap_comment %]
[% END %]
[% END %]
-- [%# Protect the trailing space of the signature marker %] -- [%# Protect the trailing space of the signature marker %]
You are receiving this mail because: You are receiving this mail because:
[% SET reason_lines = [] %] [% SET reason_lines = [] %]
......
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