From e99b3c135ae31ba62001b8308a5c3369800971e9 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Sat, 23 Sep 2006 06:14:53 +0000 Subject: Bug 353623: SanityCheck 'rescanallbugmail' parameter not working (no 'changer' specified) - Patch by Frédéric Buclin r=ghendricks a=justdave MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bugzilla/BugMail.pm | 5 ++++- contrib/bug_email.pl | 4 ++-- editusers.cgi | 3 ++- sanitycheck.cgi | 14 ++++++++++++-- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm index e78be86ec..49615c596 100644 --- a/Bugzilla/BugMail.pm +++ b/Bugzilla/BugMail.pm @@ -168,7 +168,10 @@ sub ProcessOneBug { # Convert to names, for later display $values{'changer'} = $changer; - $values{'changername'} = Bugzilla::User->new({name => $changer})->name; + # If no changer is specified, then it has no name. + if ($changer) { + $values{'changername'} = Bugzilla::User->new({name => $changer})->name; + } $values{'assigned_to'} = user_id_to_login($values{'assigned_to'}); $values{'reporter'} = user_id_to_login($values{'reporter'}); if ($values{'qa_contact'}) { diff --git a/contrib/bug_email.pl b/contrib/bug_email.pl index d2fc91b66..0f898da52 100755 --- a/contrib/bug_email.pl +++ b/contrib/bug_email.pl @@ -38,7 +38,7 @@ # # You need to work with bug_email.pl the MIME::Parser installed. # -# $Id: bug_email.pl,v 1.44 2006/07/03 21:42:47 mkanat%bugzilla.org Exp $ +# $Id: bug_email.pl,v 1.45 2006/09/22 23:14:53 lpsolit%gmail.com Exp $ ############################################################### # 02/12/2000 (SML) @@ -1173,7 +1173,7 @@ END # Send the 'you did it'-reply Reply( $SenderShort, $Message_ID,"Bugzilla success (ID $id)", $reply ); - Bugzilla::BugMail::Send($id) if( ! $test); + Bugzilla::BugMail::Send($id, {'changer' => $reporter}) if (!$test); } else { # There were critical errors in the mail - the bug couldn't be inserted. ! diff --git a/editusers.cgi b/editusers.cgi index 9baf0050f..f30c66746 100755 --- a/editusers.cgi +++ b/editusers.cgi @@ -29,6 +29,7 @@ use Bugzilla::Util; use Bugzilla::Error; use Bugzilla::User; use Bugzilla::Bug; +use Bugzilla::BugMail; use Bugzilla::Flag; use Bugzilla::Field; use Bugzilla::Group; @@ -716,7 +717,7 @@ if ($action eq 'search') { # Send mail about what we've done to bugs. # The deleted user is not notified of the changes. foreach (keys(%updatedbugs)) { - Bugzilla::BugMail::Send($_); + Bugzilla::BugMail::Send($_, {'changer' => $user->login} ); } ########################################################################### diff --git a/sanitycheck.cgi b/sanitycheck.cgi index 1c7ab284f..dd9e50598 100755 --- a/sanitycheck.cgi +++ b/sanitycheck.cgi @@ -233,9 +233,19 @@ if (defined $cgi->param('rescanallBugMail')) { ORDER BY bug_id}); Status(scalar(@$list) . ' bugs found with possibly unsent mail.'); - + + my $vars = {}; + # We cannot simply look at the bugs_activity table to find who did the + # last change in a given bug, as e.g. adding a comment doesn't add any + # entry to this table. And some other changes may be private + # (such as time-related changes or private attachments or comments) + # and so choosing this user as being the last one having done a change + # for the bug may be problematic. So the best we can do at this point + # is to choose the currently logged in user for email notification. + $vars->{'changer'} = Bugzilla->user->login; + foreach my $bugid (@$list) { - Bugzilla::BugMail::Send($bugid); + Bugzilla::BugMail::Send($bugid, $vars); } if (scalar(@$list) > 0) { -- cgit v1.2.3-24-g4f1b