From 0bd92669e6bd6cde59e85cbf9e827feb94d2536c Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Sat, 25 Feb 2006 06:53:30 +0000 Subject: Bug 328449: Remove BugMail::MessageToMTA() from Bug::RemoveVotes() - Patch by Frédéric Buclin r=mkanat a=myk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bugzilla/Bug.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 302ac38b7..71b6bc7f4 100755 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -38,7 +38,6 @@ use vars qw($legal_keywords @legal_platform use CGI::Carp qw(fatalsToBrowser); use Bugzilla::Attachment; -use Bugzilla::BugMail; use Bugzilla::Config; use Bugzilla::Constants; use Bugzilla::Field; @@ -1019,6 +1018,11 @@ sub RemoveVotes { while (my ($name, $userid, $oldvotes, $votesperuser, $maxvotesperbug) = $sth->fetchrow_array()) { push(@list, [$name, $userid, $oldvotes, $votesperuser, $maxvotesperbug]); } + + # @messages stores all emails which have to be sent, if any. + # This array is passed to the caller which will send these emails itself. + my @messages = (); + if (scalar(@list)) { foreach my $ref (@list) { my ($name, $userid, $oldvotes, $votesperuser, $maxvotesperbug) = (@$ref); @@ -1079,7 +1083,7 @@ sub RemoveVotes { $substs{"count"} = $removedvotes . "\n " . $newvotestext; my $msg = perform_substs(Param("voteremovedmail"), \%substs); - Bugzilla::BugMail::MessageToMTA($msg); + push(@messages, $msg); } my $votes = $dbh->selectrow_array("SELECT SUM(vote_count) " . "FROM votes WHERE bug_id = ?", @@ -1087,6 +1091,8 @@ sub RemoveVotes { $dbh->do("UPDATE bugs SET votes = ? WHERE bug_id = ?", undef, ($votes, $id)); } + # Now return the array containing emails to be sent. + return \@messages; } # If a user votes for a bug, or the number of votes required to -- cgit v1.2.3-24-g4f1b