From: dave%intrec.com <> Date: Thu, 15 Mar 2001 15:50:36 +0000 (+0000) Subject: Fix for bug 71550: watchers now get email based on their own preferences rather than... X-Git-Tag: bugzilla-2.12~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b60994df8219ac2587edb66c97aa0e65ec5d2c5a;p=thirdparty%2Fbugzilla.git Fix for bug 71550: watchers now get email based on their own preferences rather than the preferences of the person they are watching. Patch by jake@acutex.net, r= dave@intrec.com --- diff --git a/processmail b/processmail index acd93315c8..dbd419e411 100755 --- a/processmail +++ b/processmail @@ -540,7 +540,7 @@ sub NewProcessOneBug { if ( !defined(NewProcessOnePerson($person, $count, \@headerlist, \%values, \%defmailhead, \%fielddescription, $difftext, - $newcomments, $start, $id, 1))) { + $newcomments, $start, $id))) { # if a value is not returned, this means that the person # was not sent mail. add them to the excludedAddresses list. @@ -569,7 +569,7 @@ sub NewProcessOneBug { if ( !defined(NewProcessOnePerson($person, $count, \@headerlist, \%values, \%defmailhead, \%fielddescription, $difftext, - $newcomments, $start, $id, 1))) { + $newcomments, $start, $id))) { # if a value is not returned, this means that the person # was not sent mail. add them to the excludedAddresses list. @@ -724,6 +724,23 @@ sub filterEmailGroup ($$$) { # push @emailList, @{$force{$emailGroup}}; + # Check this user for any watchers... doing this here allows them to inhert the + # relationship to the bug of the person they are watching (if the person they + # are watching is an owner, their mail is filtered as if they were the owner). + if (Param("supportwatchers")) { + my @watchers; + foreach my $person(@emailList) { + my $personId = DBname_to_id($person); + SendSQL("SELECT watcher FROM watch WHERE watched = $personId"); + my $watcher = FetchSQLData(); + if ($watcher) { + push (@watchers, DBID_to_name($watcher)); + } + } + push(@emailList, @watchers); + } + + foreach my $person (@emailList) { my $userid; @@ -854,9 +871,9 @@ sub filterEmailGroup ($$$) { return @filteredList; } -sub NewProcessOnePerson ($$$$$$$$$$$) { +sub NewProcessOnePerson ($$$$$$$$$$) { my ($person, $count, $hlRef, $valueRef, $dmhRef, $fdRef, $difftext, - $newcomments, $start, $id, $checkWatchers) = @_; + $newcomments, $start, $id) = @_; my %values = %$valueRef; my @headerlist = @$hlRef; @@ -873,25 +890,6 @@ sub NewProcessOnePerson ($$$$$$$$$$$) { my ($userid, $emailnotification, $newemailtech, $groupset) = (FetchSQLData()); - # check for watchers, and recurse if we find any, but tell the - # recursive call not to check for watchers - # - if (Param("supportwatchers") && $checkWatchers) { - my $personId = DBname_to_id($person); - my $watcherSet = new RelationSet(); - $watcherSet->mergeFromDB("SELECT watcher FROM watch WHERE" . - " watched = $personId"); - - foreach my $watcher ( $watcherSet->toArray() ) { - - &NewProcessOnePerson(DBID_to_name($watcher) . Param('emailsuffix'), - $count, \@headerlist, \%values, - \%defmailhead, \%fielddescription, $difftext, - $newcomments, $start, $id, 0); - } - - } - if (!$newemailtech || !Param('newemailtech')) { return; }