Commit 10ad2870 authored by dmose%mozilla.org's avatar dmose%mozilla.org

fix for bug found in original 17464 patch, where removal from the CC list was…

fix for bug found in original 17464 patch, where removal from the CC list was not generating a mail. r=donm@bluemartini.com
parent 7e06172f
......@@ -398,6 +398,7 @@ ConnectToDatabase();
my $formCcSet = new RelationSet;
my $origCcSet = new RelationSet;
my $origCcString;
my $removedCcString = "";
# We make sure to check out the CC list before we actually start touching any
# bugs. mergeFromString() ultimately searches the database using a quoted
......@@ -409,6 +410,11 @@ if (defined $::FORM{'newcc'} && defined $::FORM{'id'}) {
$formCcSet->mergeFromDB("select who from cc where bug_id = $::FORM{'id'}");
$origCcString = $origCcSet->toString(); # cache a copy of the string vers
if ((exists $::FORM{'removecc'}) && (exists $::FORM{'cc'})) {
# save off the folks removed from the CC list so they can be given to
# the processmaill command line so they can be sent mail about it.
#
$removedCcString = join (',', @{$::MFORM{'cc'}});
$formCcSet->removeItemsInArray(@{$::MFORM{'cc'}});
}
$formCcSet->mergeFromString($::FORM{'newcc'});
......@@ -896,6 +902,12 @@ The changes made were:
#
my @newvalues = SnapShotBug($id);
# for passing to processmail to ensure that when someone is removed
# from one of these fields, they get notified of that fact (if desired)
#
my $origOwner = "";
my $origQaContact = "";
foreach my $c (@::log_columns) {
my $col = $c; # We modify it, don't want to modify array
# values in place.
......@@ -908,13 +920,24 @@ The changes made were:
$new = "";
}
if ($old ne $new) {
if ($col eq 'assigned_to' || $col eq 'qa_contact') {
# save off the old value for passing to processmail so the old
# owner can be notified
#
if ($col eq 'assigned_to') {
$old = ($old) ? DBID_to_name($old) : "";
$new = ($new) ? DBID_to_name($new) : "";
$origCcString .= ",$old"; # make sure to send mail to people
# if they are going to no longer get
# updates about this bug.
$origOwner = $old;
}
# ditto for the old qa contact
#
if ($col eq 'qa_contact') {
$old = ($old) ? DBID_to_name($old) : "";
$new = ($new) ? DBID_to_name($new) : "";
$origQaContact = $old;
}
if ($col eq 'product') {
RemoveVotes($id, 0,
"This bug has been moved to a different product");
......@@ -930,7 +953,20 @@ The changes made were:
print "<TABLE BORDER=1><TD><H2>Changes to bug $id submitted</H2>\n";
SendSQL("unlock tables");
system("./processmail", "-forcecc", $origCcString, $id, $::FORM{'who'});
my @ARGLIST = ("./processmail");
if ( $removedCcString ne "" ) {
push @ARGLIST, ("-forcecc", $removedCcString);
}
if ( $origOwner ne "" ) {
push @ARGLIST, ("-forceowner", $origOwner);
}
if ( $origQaContact ne "") {
push @ARGLIST, ( "-forceqacontact", $origQaContact);
}
push @ARGLIST, ($id, $::FORM{'who'});
system @ARGLIST;
print "<TD><A HREF=\"show_bug.cgi?id=$id\">Back To BUG# $id</A></TABLE>\n";
foreach my $k (keys(%dependencychanged)) {
......
......@@ -46,7 +46,11 @@ my @excludedAddresses = ();
# disable email flag for offline debugging work
my $enableSendMail = 1;
my @forcecc;
my %force;
@{$force{'QAcontact'}} = ();
@{$force{'Owner'}} = ();
@{$force{'Reporter'}} = ();
@{$force{'CClist'}} = ();
sub Lock {
if ($::lockcount <= 0) {
......@@ -552,7 +556,7 @@ sub NewProcessOneBug {
my @personlist = ($values{'assigned_to'}, $values{'reporter'},
split(/,/, $values{'cc'}),
@voterlist,
@forcecc);
$force{'CClist'});
if ($values{'qa_contact'}) { push @personlist, $values{'qa_contact'} }
for my $person (@personlist) {
$count++;
......@@ -715,6 +719,11 @@ sub filterEmailGroup ($$$) {
my @emailList = split(/,/,$emailList);
my @filteredList = ();
# the force list for this email group needs to be checked as well
#
push @emailList, @{$force{$emailGroup}};
foreach my $person (@emailList) {
my $userid;
......@@ -763,6 +772,13 @@ sub filterEmailGroup ($$$) {
}
else {
# the 255 param is here, because without a third param,
# split will trim any trailing null fields, which causes perl
# to eject lots of warnings. any suitably large number would
# do.
my %userFlags = split(/~/, $userFlagString, 255);
# The default condition is to send each person email.
# If we match the email attribute with the user flag, and
# they do not want email, then remove them from the list.
......@@ -773,19 +789,13 @@ sub filterEmailGroup ($$$) {
my $matchName = 'email' . $emailGroup . $attribute;
# the 255 param is here, because without a third param,
# split will trim any trailing null fields, which causes perl
# to eject lots of warnings. any suitably large number would
# do.
my %userFlags = split(/~/, $userFlagString, 255);
while ((my $flagName, my $flagValue) = each %userFlags) {
if ($flagName !~ /$emailGroup/) { next; }
if ($flagName !~ /$emailGroup/) {
next;
}
if ( $flagName eq $matchName
&& $flagValue ne 'on') {
if ( $flagName eq $matchName && $flagValue ne 'on') {
pop(@filteredList);
}
......@@ -793,12 +803,38 @@ sub filterEmailGroup ($$$) {
} # for each email attribute
} # if $userFlagString is valid
# check to see if the person was removed from this email
# group.
# If email was not sent to the person, then put on excluded
# addresses list.
if ( grep ($_ eq $person, @{$force{$emailGroup}} ) ) {
# if so, see if they want mail about that
#
if ( $userFlags{'email' . $emailGroup . 'Removeme'} eq 'on' ) {
# we definitely want mail sent to this person, since
# inclusion on a mail takes precedence over the previous
# exclusion
# have they been filtered for some other reason?
#
if (@filteredList == $lastCount) {
# if so, put them back
#
push (@filteredList, $person);
}
}
}
} # if $userFlagString is valid
# has the person been moved off the filtered list?
#
if (@filteredList == $lastCount ) {
# mark them as excluded
#
push (@excludedAddresses,$person);
}
......@@ -980,7 +1016,8 @@ sub ProcessOneBug {
foreach my $v (split(/,/, "$::bug{'cclist'},$::bug{'voterlist'}")) {
push @combinedcc, $v;
}
push (@combinedcc, (@forcecc));
push (@combinedcc, (@{$force{'CClist'}}, @{$force{'QAcontact'}},
@{$force{'Reporter'}}, @{$force{'Owner'}}));
my $cclist = fixaddresses("cc", \@combinedcc);
my $logstr = "Bug $i $verb";
if ($tolist ne "" || $cclist ne "") {
......@@ -1094,12 +1131,25 @@ if ($#ARGV >= 0 && $ARGV[0] eq "regenerate") {
if ($#ARGV >= 0 && $ARGV[0] eq "-forcecc") {
shift(@ARGV);
foreach my $i (split(/,/, shift(@ARGV))) {
push(@forcecc, trim($i));
push(@{$force{'CClist'}}, trim($i));
}
}
if ($#ARGV >= 0 && $ARGV[0] eq "-forceowner") {
shift(@ARGV);
@{$force{'Owner'}} = (trim(shift(@ARGV)));
}
if ($#ARGV >= 0 && $ARGV[0] eq "-forceqacontact") {
shift(@ARGV);
@{$force{'QAcontact'}} = (trim(shift(@ARGV)));
}
if (($#ARGV < 0) || ($#ARGV > 1)) {
print "Usage error: processmail {bugid} {nametoexclude}\nOr: processmail regenerate\n";
print "Usage:\n processmail {bugid} {nametoexclude} " .
"[-forcecc list,of,users]\n [-forceowner name] " .
"[-forceqacontact name]\nor\n processmail regenerate\nor\n" .
" processmail rescanall\n";
exit;
}
......
......@@ -49,6 +49,7 @@ my @emailGroups = (
);
my @emailFlags = (
'Removeme', 'If I am removed from that capacity',
'Comments', 'New Comments',
'Attachments', 'New Attachments',
'Status', 'Priority, status, severity, and milestone changes',
......@@ -60,6 +61,7 @@ my @emailFlags = (
my $defaultEmailFlagString =
'emailOwnerRemoveme~' . 'on~' .
'emailOwnerComments~' . 'on~' .
'emailOwnerAttachments~' . 'on~' .
'emailOwnerStatus~' . 'on~' .
......@@ -68,6 +70,7 @@ my $defaultEmailFlagString =
'emailOwnerCC~' . 'on~' .
'emailOwnerOther~' . 'on~' .
'emailReporterRemoveme~' . 'on~' .
'emailReporterComments~' . 'on~' .
'emailReporterAttachments~' . 'on~' .
'emailReporterStatus~' . 'on~' .
......@@ -76,6 +79,7 @@ my $defaultEmailFlagString =
'emailReporterCC~' . 'on~' .
'emailReporterOther~' . 'on~' .
'emailQAcontactRemoveme~' . 'on~' .
'emailQAcontactComments~' . 'on~' .
'emailQAcontactAttachments~' . 'on~' .
'emailQAcontactStatus~' . 'on~' .
......@@ -84,6 +88,7 @@ my $defaultEmailFlagString =
'emailQAcontactCC~' . 'on~' .
'emailQAcontactOther~' . 'on~' .
'emailCClistRemoveme~' . 'on~' .
'emailCClistComments~' . 'on~' .
'emailCClistAttachments~' . 'on~' .
'emailCClistStatus~' . 'on~' .
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment