]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1283312 - Allow searching for bugs which have had a flag value (r?, needinfo...
authorKohei Yoshino <kohei.yoshino@gmail.com>
Tue, 28 May 2019 18:50:27 +0000 (14:50 -0400)
committerGitHub <noreply@github.com>
Tue, 28 May 2019 18:50:27 +0000 (14:50 -0400)
Bugzilla/Bug.pm
extensions/TrackingFlags/Extension.pm
query.cgi

index c3c627f8404a15d2f8cede135f0bc7d8a966955e..09e3172a466a67d8e8027a5bc4d77557ce8108db 100644 (file)
@@ -43,7 +43,6 @@ use base qw(Bugzilla::Object Exporter);
 @Bugzilla::Bug::EXPORT = qw(
   bug_alias_to_id
   LogActivityEntry
-  editable_bug_fields
 );
 
 my %CLEANUP;
@@ -4446,36 +4445,6 @@ sub bug_alias_to_id {
 # Subroutines
 #####################################################################
 
-# Returns a list of currently active and editable bug fields,
-# including multi-select fields.
-sub editable_bug_fields {
-  my @fields = Bugzilla->dbh->bz_table_columns('bugs');
-
-  # Add multi-select fields
-  push(@fields,
-    map { $_->name }
-      @{Bugzilla->fields({obsolete => 0, type => FIELD_TYPE_MULTI_SELECT})});
-
-  # Obsolete custom fields are not editable.
-  my @obsolete_fields = @{Bugzilla->fields({obsolete => 1, custom => 1})};
-  @obsolete_fields = map { $_->name } @obsolete_fields;
-  foreach
-    my $remove ("bug_id", "reporter", "creation_ts", "delta_ts", "lastdiffed",
-    @obsolete_fields)
-  {
-    my $location = firstidx { $_ eq $remove } @fields;
-
-    # Ensure field exists before attempting to remove it.
-    splice(@fields, $location, 1) if ($location > -1);
-  }
-
-  Bugzilla::Hook::process('bug_editable_bug_fields', {fields => \@fields});
-
-  # Sorted because the old @::log_columns variable, which this replaces,
-  # was sorted.
-  return sort(@fields);
-}
-
 # Emit a list of dependencies or regressions. Join with bug_status and bugs
 # tables to show bugs with open statuses first, and then the others
 sub list_relationship {
index 666f35a6de8cdfa0f33917f82003a6a56a18c930..f8377437a158fc8d1504cbac8e1f9c2570b116a8 100644 (file)
@@ -411,15 +411,6 @@ sub bug_create_cf_accessors {
   }
 }
 
-sub bug_editable_bug_fields {
-  my ($self, $args) = @_;
-  my $fields         = $args->{'fields'};
-  my @tracking_flags = Bugzilla::Extension::TrackingFlags::Flag->get_all;
-  foreach my $flag (@tracking_flags) {
-    push(@$fields, $flag->name);
-  }
-}
-
 sub search_operator_field_override {
   my ($self, $args) = @_;
   my $operators      = $args->{'operators'};
index c15575a885bb7392d21ce32d827a6b2bfd5be0a3..92ef971e3e19f5346137da2bfefa63e7c4a6ec21 100755 (executable)
--- a/query.cgi
+++ b/query.cgi
@@ -162,12 +162,22 @@ if (Bugzilla->params->{'usetargetmilestone'}) {
 }
 
 my @chfields;
+my $search_fields = Bugzilla::Search::search_fields({obsolete => 0});
+my $uneditable_fields_re = join('|', qw(
+  attachments\.submitter
+  bug_id
+  commenter
+  creation_ts
+  delta_ts
+  lastdiffed
+  reporter
+));
 
 push @chfields, "[Bug creation]";
 
 # This is what happens when you have variables whose definition depends
 # on the DB schema, and then the underlying schema changes...
-foreach my $val (editable_bug_fields()) {
+foreach my $val (keys %$search_fields) {
   if ($val eq 'classification_id') {
     $val = 'classification';
   }
@@ -177,6 +187,9 @@ foreach my $val (editable_bug_fields()) {
   elsif ($val eq 'component_id') {
     $val = 'component';
   }
+  elsif ($val =~ /^(?:$uneditable_fields_re)$/) {
+    next;
+  }
   push @chfields, $val;
 }
 
@@ -204,7 +217,7 @@ $vars->{'resolution'}
 
 # Boolean charts
 my @fields = sort { lc($a->description) cmp lc($b->description) }
-  values %{Bugzilla::Search::search_fields({obsolete => 0})};
+  values %$search_fields;
 unshift(@fields, {name => "noop", description => "---"});
 $vars->{'fields'} = \@fields;