]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1502500 - Adding the qe-verify flag as an editable field when using Bugzilla...
authorKohei Yoshino <kohei.yoshino@gmail.com>
Fri, 1 Mar 2019 23:33:56 +0000 (18:33 -0500)
committerGitHub <noreply@github.com>
Fri, 1 Mar 2019 23:33:56 +0000 (18:33 -0500)
Bugzilla/Flag.pm
buglist.cgi
process_bug.cgi
template/en/default/flag/list.html.tmpl
template/en/default/list/edit-multiple.html.tmpl

index 3ed055b3d4ad120a20a88752586727cfc8a2fbff..673f5ce0154b94f026eebf6fa6186f4ef71b7dfa 100644 (file)
@@ -872,7 +872,6 @@ sub extract_flags_from_cgi {
 
   # Extract a list of flag type IDs from field names.
   my @flagtype_ids = map(/^flag_type-(\d+)$/ ? $1 : (), $cgi->param());
-  @flagtype_ids = grep($cgi->param("flag_type-$_") ne 'X', @flagtype_ids);
 
   # Extract a list of existing flag IDs.
   my @flag_ids = map(/^flag-(\d+)$/ ? $1 : (), $cgi->param());
@@ -957,18 +956,14 @@ sub extract_flags_from_cgi {
     # We are only interested in flags the user tries to create.
     next unless scalar(grep { $_ == $type_id } @flagtype_ids);
 
-    # Get the number of flags of this type already set for this target.
-    my $has_flags = $class->count({
+    # Get the current flags of this type already set for this target.
+    my $current_flags = $class->match({
       'type_id'     => $type_id,
       'target_type' => $attachment ? 'attachment' : 'bug',
       'bug_id'      => $bug->bug_id,
       'attach_id'   => $attachment ? $attachment->id : undef
     });
 
-    # Do not create a new flag of this type if this flag type is
-    # not multiplicable and already has a flag set.
-    next if (!$flag_type->is_multiplicable && $has_flags);
-
     my $status = $cgi->param("flag_type-$type_id");
     trick_taint($status);
 
@@ -987,6 +982,10 @@ sub extract_flags_from_cgi {
         last unless $flag_type->is_multiplicable;
       }
     }
+    elsif (!$flag_type->is_multiplicable && scalar @$current_flags) {
+      # Update or delete the current flag if the type is not multiplicable.
+      push(@new_flags, {id => @$current_flags[0]->id, status => $status});
+    }
     else {
       push(@new_flags, {type_id => $type_id, status => $status});
     }
index b3011c16e824b193e8f8a570ac92955c7957f80b..660c238ed5bb51e19f6576e400acfe527fe46fda 100755 (executable)
@@ -1080,6 +1080,9 @@ if ($dotweak && scalar @bugs) {
         = [map($_->name, grep($_->is_active, @{$one_product->milestones}))];
     }
   }
+
+  # Allow to edit flags as well
+  $vars->{'flag_types'} = Bugzilla::FlagType::match({target_type => 'bug'});
 }
 
 # If we're editing a stored query, use the existing query name as default for
index 7e22a6ef1a6383e359c961c8e96e30a435f3315e..062af5008be45947358a467202a7464eac2d965b 100755 (executable)
@@ -396,14 +396,13 @@ foreach my $b (@bug_objects) {
   }
 }
 
-if (defined $cgi->param('id')) {
-
-  # Flags should be set AFTER the bug has been moved into another
-  # product/component. The structure of flags code doesn't currently
-  # allow them to be set using set_all.
+# Flags should be set AFTER the bug has been moved into another
+# product/component. The structure of flags code doesn't currently
+# allow them to be set using set_all.
+foreach my $bug (@bug_objects) {
   my ($flags, $new_flags)
-    = Bugzilla::Flag->extract_flags_from_cgi($first_bug, undef, $vars);
-  $first_bug->set_flags($flags, $new_flags);
+    = Bugzilla::Flag->extract_flags_from_cgi($bug, undef, $vars);
+  $bug->set_flags($flags, $new_flags);
 }
 
 ##############################
index bf1c8a6b31988b91067c1e48e14e616b32a91050..f4aeb1e99110dc23f64d32bdb9c35d06a4b0c45c 100644 (file)
                 class="flag_select flag_type-[% type.id %]"
                 data-id="[% type.id %]" data-name="[% type.name FILTER html FILTER no_break %]"
                 [% IF !can_edit_flag %] disabled="disabled"[% END %]>
+        [% IF dontchange %]
+          <option value="[% dontchange FILTER html %]" selected>[% dontchange FILTER html %]</option>
+        [% END %]
         [%# Only display statuses the user is allowed to set. %]
         [% IF !flag
               || (can_edit_flag && user.can_unset_flag(type, flag.status) && user.can_request_flag(type))
index 8224a3040fdf29ddb0076cdb3ae638bde8f12787..88525de12351d9103f17d2ed8621ca3f89c55329 100644 (file)
 
 </table>
 
+[% PROCESS "flag/list.html.tmpl" any_flags_requesteeble = 1 %]
+
 <b><label for="comment">Additional Comments:</label></b>
 [% IF user.is_insider %]
   <input type="checkbox" name="comment_is_private" value="1"