From ba10f28c9215b2ebeae7a6620183eec6c4721b35 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Wed, 26 Mar 2008 10:05:19 +0000 Subject: Bug 413184: Unify all of the update_ functions in Bugzilla::Bug Patch By Max Kanat-Alexander r=LpSolit, a=LpSolit --- process_bug.cgi | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'process_bug.cgi') diff --git a/process_bug.cgi b/process_bug.cgi index 277cbb0fd..ffa06cee3 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -542,19 +542,17 @@ foreach my $bug (@bug_objects) { } } - $bug->update_keywords($timestamp); - - my ($cc_removed) = $bug->update_cc($timestamp); - $cc_removed = [map {$_->login} @$cc_removed]; - - my ($dep_changes) = $bug->update_dependencies($timestamp); - - # Convert the "changes" hash into a list of all the bug ids, then - # convert that into a hash to eliminate duplicates. ("map {@$_}" collapses - # an array of arrays.) - my @all_changed_deps = map { @$_ } @{$dep_changes->{'dependson'}}; - push(@all_changed_deps, map { @$_ } @{$dep_changes->{'blocked'}}); - my %changed_deps = map { $_ => 1 } @all_changed_deps; + # To get a list of all changed dependencies, convert the "changes" arrays + # into a long string, then collapse that string into unique numbers in + # a hash. + my $all_changed_deps = join(', ', @{ $changes->{'dependson'} || [] }); + $all_changed_deps = join(', ', @{ $changes->{'blocked'} || [] }, + $all_changed_deps); + my %changed_deps = map { $_ => 1 } split(', ', $all_changed_deps); + # When clearning one field (say, blocks) and filling in the other + # (say, dependson), an empty string can get into the hash and cause + # an error later. + delete $changed_deps{''}; # $msgs will store emails which have to be sent to voters, if any. my $msgs; @@ -582,10 +580,11 @@ foreach my $bug (@bug_objects) { MessageToMTA($msg); } - my $old_qa = $changes->{'qa_contact'} ? $changes->{'qa_contact'}->[0] : ''; - my $old_own = $changes->{'assigned_to'} ? $changes->{'assigned_to'}->[0] : ''; + my $old_qa = $changes->{'qa_contact'} ? $changes->{'qa_contact'}->[0] : ''; + my $old_own = $changes->{'assigned_to'} ? $changes->{'assigned_to'}->[0] : ''; + my $old_cc = $changes->{cc} ? $changes->{cc}->[0] : ''; $vars->{'mailrecipients'} = { - cc => $cc_removed, + cc => [split(/[\s,]+/, $old_cc)], owner => $old_own, qacontact => $old_qa, changer => Bugzilla->user->login }; -- cgit v1.2.3-24-g4f1b