summaryrefslogtreecommitdiffstats
path: root/Bugzilla/BugMail.pm
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 /Bugzilla/BugMail.pm
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
Diffstat (limited to 'Bugzilla/BugMail.pm')
-rw-r--r--Bugzilla/BugMail.pm53
1 files changed, 34 insertions, 19 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,