summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Green <sgreen@redhat.com>2013-11-18 00:08:31 +0100
committerSimon Green <sgreen@redhat.com>2013-11-18 00:08:31 +0100
commit17b7781c6178e67375edd37907be3eaee72b84d6 (patch)
tree554cd42b9c7d6c239e3f2ea339b0ab32a4c46a78
parent1cf4971f32fe1fffb3919c9a459e92f6a2c0ca02 (diff)
downloadbugzilla-17b7781c6178e67375edd37907be3eaee72b84d6.tar.gz
bugzilla-17b7781c6178e67375edd37907be3eaee72b84d6.tar.xz
Bug 97956 - Give summary and URL of bugs added or removed from dependencies in bugmail
r=LpSolit, a=sgreen
-rw-r--r--Bugzilla/BugMail.pm53
-rw-r--r--template/en/default/email/bugmail.html.tmpl19
-rw-r--r--template/en/default/email/bugmail.txt.tmpl9
3 files changed, 61 insertions, 20 deletions
diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm
index e84a370c0..4db332e06 100644
--- a/Bugzilla/BugMail.pm
+++ b/Bugzilla/BugMail.pm
@@ -117,7 +117,10 @@ sub Send {
# A user_id => roles hash to keep track of people.
my %recipients;
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
# the relationships in a hash. The keys are userids, the values are an
# array of role constants.
@@ -161,8 +164,17 @@ sub Send {
$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
foreach my $user_id (keys %recipients) {
$user_cache{$user_id} ||= new Bugzilla::User($user_id);
@@ -249,16 +261,17 @@ sub Send {
# Email the user if the dep check passed.
if ($dep_ok) {
my $sent_mail = sendMail(
- { to => $user,
- bug => $bug,
- comments => $comments,
- date => $date,
- changer => $changer,
- watchers => exists $watching{$user_id} ?
- $watching{$user_id} : undef,
- diffs => \@diffs,
+ { to => $user,
+ bug => $bug,
+ comments => $comments,
+ date => $date,
+ changer => $changer,
+ watchers => exists $watching{$user_id} ?
+ $watching{$user_id} : undef,
+ diffs => \@diffs,
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;
}
@@ -280,15 +293,16 @@ sub Send {
sub sendMail {
my $params = shift;
- my $user = $params->{to};
- my $bug = $params->{bug};
- my @send_comments = @{ $params->{comments} };
- my $date = $params->{date};
- my $changer = $params->{changer};
- my $watchingRef = $params->{watchers};
- my @diffs = @{ $params->{diffs} };
- my $relRef = $params->{rels_which_want};
- my $dep_only = $params->{dep_only};
+ my $user = $params->{to};
+ my $bug = $params->{bug};
+ my @send_comments = @{ $params->{comments} };
+ my $date = $params->{date};
+ my $changer = $params->{changer};
+ my $watchingRef = $params->{watchers};
+ my @diffs = @{ $params->{diffs} };
+ my $relRef = $params->{rels_which_want};
+ my $dep_only = $params->{dep_only};
+ my $referenced_bugs = $params->{referenced_bugs};
# Only display changes the user is allowed see.
my @display_diffs;
@@ -350,6 +364,7 @@ sub sendMail {
changer => $changer,
diffs => \@display_diffs,
changedfields => \@changedfields,
+ referenced_bugs => $user->visible_bugs($referenced_bugs),
new_comments => \@send_comments,
threadingmarker => build_thread_marker($bug->id, $user->id, !$bug->lastdiffed),
bugmailtype => $bugmailtype,
diff --git a/template/en/default/email/bugmail.html.tmpl b/template/en/default/email/bugmail.html.tmpl
index 6464e0a96..a5fc25ee3 100644
--- a/template/en/default/email/bugmail.html.tmpl
+++ b/template/en/default/email/bugmail.html.tmpl
@@ -29,9 +29,26 @@
</div>
[% END %]
</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>
<span>You are receiving this mail because:</span>
-
+
<ul>
[% FOREACH reason = reasons %]
[% IF reason_descs.$reason %]
diff --git a/template/en/default/email/bugmail.txt.tmpl b/template/en/default/email/bugmail.txt.tmpl
index 92c9a33cb..b8d11e0e1 100644
--- a/template/en/default/email/bugmail.txt.tmpl
+++ b/template/en/default/email/bugmail.txt.tmpl
@@ -22,6 +22,15 @@
[%+ comment.body_full({ is_bugmail => 1, wrap => 1 }) %]
[% 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 %]
You are receiving this mail because:
[% SET reason_lines = [] %]