aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-06-25 14:16:27 -0700
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-06-25 14:16:27 -0700
commit0d39e7b417190ad672219768eab41d627cc68bb9 (patch)
tree6cf83f87c52613161665338d942cc08904b0cb8c /process_bug.cgi
parentBug 457373: Refactor the permissions system in Bugzilla::Install::Filesystem (diff)
downloadbugzilla-0d39e7b417190ad672219768eab41d627cc68bb9.tar.gz
bugzilla-0d39e7b417190ad672219768eab41d627cc68bb9.tar.bz2
bugzilla-0d39e7b417190ad672219768eab41d627cc68bb9.zip
Bug 573173: Make Bugzilla::Bug's add_group and remove_group take group
names instead of ids r=dkl, a=mkanat
Diffstat (limited to 'process_bug.cgi')
-rwxr-xr-xprocess_bug.cgi25
1 files changed, 4 insertions, 21 deletions
diff --git a/process_bug.cgi b/process_bug.cgi
index 7759d03dc..f6da2af61 100755
--- a/process_bug.cgi
+++ b/process_bug.cgi
@@ -337,27 +337,10 @@ foreach my $field (grep(/^defined_isprivate/, $cgi->param())) {
}
$set_all_fields{comment_is_private} = \%is_private;
-my %groups = ( add => [], remove => [] );
-my %checked_bit; # Used to avoid adding groups twice (defined_ + actual bit-)
-foreach my $param_name (grep(/bit-\d+$/, $cgi->param())) {
- $param_name =~ /bit-(\d+)$/;
- my $gid = $1;
- next if $checked_bit{$gid};
- my $bit_param = "bit-$gid";
- if (should_set($bit_param, 1)) {
- # Check ! first to avoid having to check defined below.
- if (!$cgi->param($bit_param)) {
- push(@{ $groups{remove} }, $gid);
- }
- # "== 1" is important because mass-change uses -1 to mean
- # "don't change this restriction"
- elsif ($cgi->param($bit_param) == 1) {
- push(@{ $groups{add} }, $gid);
- }
- }
- $checked_bit{$gid} = 1;
-}
-$set_all_fields{groups} = \%groups;
+my @check_groups = $cgi->param('defined_groups');
+my @set_groups = $cgi->param('groups');
+my ($removed_groups) = diff_arrays(\@check_groups, \@set_groups);
+$set_all_fields{groups} = { add => \@set_groups, remove => $removed_groups };
my @custom_fields = Bugzilla->active_custom_fields;
foreach my $field (@custom_fields) {