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 ++++++++++- .../en/default/hook/admin/products/updated-changes.html.tmpl | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'extensions') 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 diff --git a/extensions/Voting/template/en/default/hook/admin/products/updated-changes.html.tmpl b/extensions/Voting/template/en/default/hook/admin/products/updated-changes.html.tmpl index 876c51187..139fc641b 100644 --- a/extensions/Voting/template/en/default/hook/admin/products/updated-changes.html.tmpl +++ b/extensions/Voting/template/en/default/hook/admin/products/updated-changes.html.tmpl @@ -89,8 +89,8 @@ overwritten, which happens otherwise %] [% INCLUDE bug/process/results.html.tmpl type = 'votes' - mailrecipients = { 'changer' => user.login } header_done = 1 + sent_bugmail = changes.confirmed_bugs_sent_bugmail.$id id = id %] [% END %] -- cgit v1.2.3-24-g4f1b