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
...@@ -117,7 +117,10 @@ sub Send { ...@@ -117,7 +117,10 @@ sub Send {
# A user_id => roles hash to keep track of people. # A user_id => roles hash to keep track of people.
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);
...@@ -249,16 +261,17 @@ sub Send { ...@@ -249,16 +261,17 @@ sub Send {
# Email the user if the dep check passed. # Email the user if the dep check passed.
if ($dep_ok) { if ($dep_ok) {
my $sent_mail = sendMail( my $sent_mail = sendMail(
{ to => $user, { to => $user,
bug => $bug, bug => $bug,
comments => $comments, comments => $comments,
date => $date, date => $date,
changer => $changer, changer => $changer,
watchers => exists $watching{$user_id} ? watchers => exists $watching{$user_id} ?
$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;
} }
...@@ -280,15 +293,16 @@ sub Send { ...@@ -280,15 +293,16 @@ sub Send {
sub sendMail { sub sendMail {
my $params = shift; my $params = shift;
my $user = $params->{to}; my $user = $params->{to};
my $bug = $params->{bug}; my $bug = $params->{bug};
my @send_comments = @{ $params->{comments} }; my @send_comments = @{ $params->{comments} };
my $date = $params->{date}; my $date = $params->{date};
my $changer = $params->{changer}; my $changer = $params->{changer};
my $watchingRef = $params->{watchers}; my $watchingRef = $params->{watchers};
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,9 +29,26 @@ ...@@ -29,9 +29,26 @@
</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>
<ul> <ul>
[% FOREACH reason = reasons %] [% FOREACH reason = reasons %]
[% IF reason_descs.$reason %] [% IF reason_descs.$reason %]
......
...@@ -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