summaryrefslogtreecommitdiffstats
path: root/process_bug.cgi
diff options
context:
space:
mode:
authorbbaetz%cs.mcgill.ca <>2001-11-03 14:49:23 +0100
committerbbaetz%cs.mcgill.ca <>2001-11-03 14:49:23 +0100
commitd5a7a714359ed12b3c26e086f4c852cdbf4cfe61 (patch)
tree98dc0ed6349a26c7969e4049c7cc41a3a363c183 /process_bug.cgi
parent539dccaf5bb64aec3b62794a0524df4901b3c203 (diff)
downloadbugzilla-d5a7a714359ed12b3c26e086f4c852cdbf4cfe61.tar.gz
bugzilla-d5a7a714359ed12b3c26e086f4c852cdbf4cfe61.tar.xz
Bug 107718 - mass changes give all changed bugs the groupset of the first
bug in the list. Do bit fiddling instead of adding groupsets from the first bug. r=justdave, jake
Diffstat (limited to 'process_bug.cgi')
-rwxr-xr-xprocess_bug.cgi57
1 files changed, 20 insertions, 37 deletions
diff --git a/process_bug.cgi b/process_bug.cgi
index 9ac1e8744..4cfb0e9c8 100755
--- a/process_bug.cgi
+++ b/process_bug.cgi
@@ -547,45 +547,28 @@ sub CheckonComment( $ ) {
# select lists. This means that instead of looking for the bit-X values in
# the form, we need to loop through all the bug groups this user has access
# to, and for each one, see if it's selected.
-# In addition, adding a little extra work so that we don't clobber groupsets
-# for bugs where the user doesn't have access to the group, but does to the
-# bug (as with the proposed reporter access patch.)
+# In order to make mass changes work correctly, keep a sum of bits for groups
+# added, and another one for groups removed, and then let mysql do the bit
+# operations
+# If the form element isn't present, or the user isn't in the group, leave
+# it as-is
if($::usergroupset ne '0') {
- # We want to start from zero and build up, since if all boxes have been
- # unchecked, we want to revert to 0.
- DoComma();
- $::query .= "groupset = 0";
- my ($id) = (@idlist);
- SendSQL(<<_EOQ_);
- SELECT bit, bit & $::usergroupset != 0, bit & bugs.groupset != 0
- FROM groups, bugs
- WHERE isbuggroup != 0 AND bug_id = $id
- ORDER BY bit
-_EOQ_
- while (my ($b, $userhasgroup, $bughasgroup) = FetchSQLData()) {
- if (!$::FORM{"bit-$b"}) {
- # If we make it here, the item didn't exist on the form or the user
- # said to clear it. The only time we add this group back in is if
- # the bug already has this group on it and the user can't access it.
- if ($bughasgroup && !$userhasgroup) {
- $::query .= " + $b";
- }
- } elsif ($::FORM{"bit-$b"} == -1) {
- # If we get here, the user came from the change several bugs form, and
- # said not to change this group restriction. So we'll add this group
- # back in only if the bug already has it.
- if ($bughasgroup) {
- $::query .= " + $b";
- }
- } else {
- # If we get here, the user said to set this group. If they don't have
- # access to it, we'll use what's already on the bug, otherwise we'll
- # add this one in.
- if ($userhasgroup || $bughasgroup) {
- $::query .= " + $b";
- }
+ my $groupAdd = "0";
+ my $groupDel = "0";
+
+ SendSQL("SELECT bit, isactive FROM groups WHERE " .
+ "isbuggroup != 0 AND bit & $::usergroupset != 0 ORDER BY bit");
+ while (my ($b, $isactive) = FetchSQLData()) {
+ if (!$::FORM{"bit-$b"}) {
+ $groupDel .= "+$b";
+ } elsif ($::FORM{"bit-$b"} == 1 && $isactive) {
+ $groupAdd .= "+$b";
+ }
+ }
+ if ($groupAdd ne "0" || $groupDel ne "0") {
+ DoComma();
+ $::query .= "groupset = ((groupset & ~($groupDel)) | ($groupAdd))";
}
- }
}
foreach my $field ("rep_platform", "priority", "bug_severity",