summaryrefslogtreecommitdiffstats
path: root/post_bug.cgi
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-04-06 01:26:09 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-04-06 01:26:09 +0200
commitd74d76b0730621b09571775902899d7030ca3150 (patch)
treedfeb8f80dc10cd0e25e0c7ae89f8dd48677db9b6 /post_bug.cgi
parent3b351275ab6f8090620234dd2b3ee8a9ef72e599 (diff)
downloadbugzilla-d74d76b0730621b09571775902899d7030ca3150.tar.gz
bugzilla-d74d76b0730621b09571775902899d7030ca3150.tar.xz
Bug 556429: Stop sending bugmail from inside the template
r=LpSolit, a=LpSolit
Diffstat (limited to 'post_bug.cgi')
-rwxr-xr-xpost_bug.cgi26
1 files changed, 13 insertions, 13 deletions
diff --git a/post_bug.cgi b/post_bug.cgi
index 5a1da173f..881568298 100755
--- a/post_bug.cgi
+++ b/post_bug.cgi
@@ -231,9 +231,6 @@ my ($flags, $new_flags) = Bugzilla::Flag->extract_flags_from_cgi($bug, undef, $v
$bug->set_flags($flags, $new_flags);
$bug->update($timestamp);
-# Email everyone the details of the new bug
-$vars->{'mailrecipients'} = {'changer' => $user->login};
-
$vars->{'id'} = $id;
$vars->{'bug'} = $bug;
@@ -241,22 +238,25 @@ Bugzilla::Hook::process('post_bug_after_creation', { vars => $vars });
ThrowCodeError("bug_error", { bug => $bug }) if $bug->error;
-$vars->{'sentmail'} = [];
-
-push (@{$vars->{'sentmail'}}, { type => 'created',
- id => $id,
- });
-
-foreach my $i (@{$bug->dependson || []}, @{$bug->blocked || []}) {
- push (@{$vars->{'sentmail'}}, { type => 'dep', id => $i, });
-}
-
if ($token) {
trick_taint($token);
$dbh->do('UPDATE tokens SET eventdata = ? WHERE token = ?', undef,
("createbug:$id", $token));
}
+my $recipients = { changer => $user->login };
+my $bug_sent = Bugzilla::BugMail::Send($id, $recipients);
+$bug_sent->{type} = 'created';
+$bug_sent->{id} = $id;
+my @all_mail_results = ($bug_sent);
+foreach my $dep (@{$bug->dependson || []}, @{$bug->blocked || []}) {
+ my $dep_sent = Bugzilla::BugMail::Send($dep, $recipients);
+ $dep_sent->{type} = 'dep';
+ $dep_sent->{id} = $dep;
+ push(@all_mail_results, $dep_sent);
+}
+$vars->{sentmail} = \@all_mail_results;
+
print $cgi->header();
$template->process("bug/create/created.html.tmpl", $vars)
|| ThrowTemplateError($template->error());