summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-05-23 07:11:23 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-05-23 07:11:23 +0200
commit7d308032e344edec643ab1a1345ac7af7b0962fe (patch)
treec698abd7f02ee1067e63fd2c3dc4b4af60751eb4 /Bugzilla
parent5f2a455c24b4b6d4dc2ac2b59fc47f0c0f2e5bc6 (diff)
downloadbugzilla-7d308032e344edec643ab1a1345ac7af7b0962fe.tar.gz
bugzilla-7d308032e344edec643ab1a1345ac7af7b0962fe.tar.xz
Bug 556403: Move adding/removing of CCs from process_bug.cgi into
Bugzilla::Bug::set_all
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Bug.pm29
1 files changed, 17 insertions, 12 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index c1f4dc12f..939829cc5 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -1892,12 +1892,7 @@ sub set_all {
# strict_isolation checks mean that we should set the groups
# immediately after changing the product.
- foreach my $group (@{ $params->{groups}->{add} || [] }) {
- $self->add_group($group);
- }
- foreach my $group (@{ $params->{groups}->{remove} || [] }) {
- $self->remove_group($group);
- }
+ $self->_add_remove($params, 'groups');
if (exists $params->{'dependson'} or exists $params->{'blocked'}) {
my %set_deps;
@@ -1953,12 +1948,7 @@ sub set_all {
$self->reset_assigned_to if $params->{'reset_assigned_to'};
$self->reset_qa_contact if $params->{'reset_qa_contact'};
- foreach my $url (@{ $params->{see_also}->{add} || [] }) {
- $self->add_see_also($url);
- }
- foreach my $url (@{ $params->{see_also}->{remove} || [] }) {
- $self->remove_see_also($url);
- }
+ $self->_add_remove($params, 'see_also');
# And set custom fields.
my @custom_fields = Bugzilla->active_custom_fields;
@@ -1968,6 +1958,21 @@ sub set_all {
$self->set_custom_field($field, $params->{$fname});
}
}
+
+ $self->_add_remove($params, 'cc');
+}
+
+# Helper for set_all that helps with fields that have an "add/remove"
+# pattern instead of a "set_" pattern.
+sub _add_remove {
+ my ($self, $params, $name) = @_;
+ my @add = @{ $params->{$name}->{add} || [] };
+ my @remove = @{ $params->{$name}->{remove} || [] };
+ $name =~ s/s$//;
+ my $add_method = "add_$name";
+ my $remove_method = "remove_$name";
+ $self->$add_method($_) foreach @add;
+ $self->$remove_method($_) foreach @remove;
}
sub set_alias { $_[0]->set('alias', $_[1]); }