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 --- process_bug.cgi | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'process_bug.cgi') diff --git a/process_bug.cgi b/process_bug.cgi index a489594f4..b3006565f 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -1960,7 +1960,10 @@ foreach my $id (@idlist) { # my $origOwner = ""; my $origQaContact = ""; - + + # $msgs will store emails which have to be sent to voters, if any. + my $msgs; + foreach my $c (@::log_columns) { my $col = $c; # We modify it, don't want to modify array # values in place. @@ -2004,10 +2007,13 @@ foreach my $id (@idlist) { } if ($col eq 'product') { - RemoveVotes($id, 0, - "This bug has been moved to a different product"); + # If some votes have been removed, RemoveVotes() returns + # a list of messages to send to voters. + # We delay the sending of these messages till tables are unlocked. + $msgs = RemoveVotes($id, 0, + "This bug has been moved to a different product"); } - + if ($col eq 'bug_status' && IsOpenedState($old) ne IsOpenedState($new)) { @@ -2026,6 +2032,11 @@ foreach my $id (@idlist) { } $dbh->bz_unlock_tables(); + # Now is a good time to send email to voters. + foreach my $msg (@$msgs) { + Bugzilla::BugMail::MessageToMTA($msg); + } + if ($duplicate) { # Check to see if Reporter of this bug is reporter of Dupe SendSQL("SELECT reporter FROM bugs WHERE bug_id = " . -- cgit v1.2.3-24-g4f1b