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 --- extensions/Voting/Extension.pm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'extensions/Voting/Extension.pm') diff --git a/extensions/Voting/Extension.pm b/extensions/Voting/Extension.pm index 5a1cc518e..5d455ad36 100644 --- a/extensions/Voting/Extension.pm +++ b/extensions/Voting/Extension.pm @@ -29,6 +29,7 @@ use strict; use base qw(Bugzilla::Extension); use Bugzilla::Bug; +use Bugzilla::BugMail; use Bugzilla::Constants; use Bugzilla::Error; use Bugzilla::Field; @@ -614,10 +615,12 @@ sub _update_votes { $dbh->bz_commit_transaction(); $vars->{'type'} = "votes"; - $vars->{'mailrecipients'} = { 'changer' => $user->login }; $vars->{'title_tag'} = 'change_votes'; foreach my $bug_id (@updated_bugs) { $vars->{'id'} = $bug_id; + $vars->{'sent_bugmail'} = + Bugzilla::BugMail::Send($bug_id, { 'changer' => $user->login }); + $template->process("bug/process/results.html.tmpl", $vars) || ThrowTemplateError($template->error()); # Set header_done to 1 only after the first bug. @@ -723,6 +726,12 @@ sub _modify_bug_votes { foreach my $msg (@msgs) { MessageToMTA($msg); } + # And send out emails about changed bugs + foreach my $bug_id (@updated_bugs) { + my $sent_bugmail = Bugzilla::BugMail::Send( + $bug_id, { changer => Bugzilla->user->login }); + $changes->{'confirmed_bugs_sent_bugmail'}->{$bug_id} = $sent_bugmail; + } } # If a bug is moved to a product which allows less votes per bug -- cgit v1.2.3-24-g4f1b