]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1568704 - Allow to use --- as empty Resolution field value in Custom Search
authorKohei Yoshino <kohei.yoshino@gmail.com>
Wed, 31 Jul 2019 05:47:02 +0000 (01:47 -0400)
committerGitHub <noreply@github.com>
Wed, 31 Jul 2019 05:47:02 +0000 (01:47 -0400)
Bugzilla/Search.pm

index 9f536792e6c6703ae2caea41e1f3fb58c8ab8051..8155192f1defc30ba889b866bce3c07c8183fa2e 100644 (file)
@@ -381,6 +381,9 @@ sub SPECIAL_PARSING {
 
     # BMO - add ability to use pronoun for triage owners
     triage_owner => \&_triage_owner_pronoun,
+
+    # Misc.
+    resolution => \&_chart_resolution_parser,
   };
   foreach my $field (Bugzilla->active_custom_fields({skip_extensions => 1})) {
     if ($field->type == FIELD_TYPE_DATETIME) {
@@ -2541,6 +2544,21 @@ sub _triage_owner_pronoun {
   }
 }
 
+######################################
+# "Special Parsing" Functions: Misc. #
+######################################
+
+sub _chart_resolution_parser {
+  my ($self, $args) = @_;
+  my ($value, $operator) = @$args{qw(value operator)};
+
+  # Treat `---` as empty
+  if (trim($value) eq '---' && $operator =~ /^(?:not)?equals$/) {
+    $args->{value} = $args->{all_values} = $args->{quoted} = '';
+    $args->{operator} = $operator eq 'equals' ? 'isempty' : 'isnotempty';
+  }
+}
+
 #####################################################################
 # Search Functions
 #####################################################################