From d74d76b0730621b09571775902899d7030ca3150 Mon Sep 17 00:00:00 2001 From: Max Kanat-Alexander Date: Mon, 5 Apr 2010 16:26:09 -0700 Subject: Bug 556429: Stop sending bugmail from inside the template r=LpSolit, a=LpSolit --- attachment.cgi | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'attachment.cgi') diff --git a/attachment.cgi b/attachment.cgi index f85fb3a19..0b389501b 100755 --- a/attachment.cgi +++ b/attachment.cgi @@ -39,6 +39,7 @@ use strict; use lib qw(. lib); use Bugzilla; +use Bugzilla::BugMail; use Bugzilla::Constants; use Bugzilla::Error; use Bugzilla::Flag; @@ -532,8 +533,6 @@ sub insert { $dbh->bz_commit_transaction; # Define the variables and functions that will be passed to the UI template. - $vars->{'mailrecipients'} = { 'changer' => $user->login, - 'owner' => $owner }; $vars->{'attachment'} = $attachment; # We cannot reuse the $bug object as delta_ts has eventually been updated # since the object was created. @@ -541,6 +540,9 @@ sub insert { $vars->{'header_done'} = 1; $vars->{'contenttypemethod'} = $cgi->param('contenttypemethod'); + my $recipients = { 'changer' => $user->login, 'owner' => $owner }; + $vars->{'sent_bugmail'} = Bugzilla::BugMail::Send($bugid, $recipients); + print $cgi->header(); # Generate and return the UI (HTML page) from the appropriate template. $template->process("attachment/created.html.tmpl", $vars) @@ -662,10 +664,11 @@ sub update { $dbh->bz_commit_transaction(); # Define the variables and functions that will be passed to the UI template. - $vars->{'mailrecipients'} = { 'changer' => $user->login }; $vars->{'attachment'} = $attachment; $vars->{'bugs'} = [$bug]; $vars->{'header_done'} = 1; + $vars->{'sent_bugmail'} = + Bugzilla::BugMail::Send($bug->id, { 'changer' => $user->login }); print $cgi->header(); @@ -714,7 +717,6 @@ sub delete_attachment { $vars->{'attachment'} = $attachment; $vars->{'date'} = $date; $vars->{'reason'} = clean_text($cgi->param('reason') || ''); - $vars->{'mailrecipients'} = { 'changer' => $user->login }; $template->process("attachment/delete_reason.txt.tmpl", $vars, \$msg) || ThrowTemplateError($template->error()); @@ -738,6 +740,9 @@ sub delete_attachment { $vars->{'bugs'} = [$bug]; $vars->{'header_done'} = 1; + $vars->{'sent_bugmail'} = + Bugzilla::BugMail::Send($bug->id, { 'changer' => $user->login }); + $template->process("attachment/updated.html.tmpl", $vars) || ThrowTemplateError($template->error()); } -- cgit v1.2.3-24-g4f1b