summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2009-05-20 22:55:08 +0200
committermkanat%bugzilla.org <>2009-05-20 22:55:08 +0200
commite82fe9ae884fa439494a4755cfcc218481ae094d (patch)
treead14bf98a39dc972a92a3383e7c9018c9491e739 /Bugzilla
parent522e08496dfc2714dc71a7431e637389536ef7b7 (diff)
downloadbugzilla-e82fe9ae884fa439494a4755cfcc218481ae094d.tar.gz
bugzilla-e82fe9ae884fa439494a4755cfcc218481ae094d.tar.xz
Bug 302511: Remove QuickSearch's dependency on default priority values
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=wurblzap, a=mkanat
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Search/Quicksearch.pm22
1 files changed, 19 insertions, 3 deletions
diff --git a/Bugzilla/Search/Quicksearch.pm b/Bugzilla/Search/Quicksearch.pm
index 54f6c9366..70b5e2f2c 100644
--- a/Bugzilla/Search/Quicksearch.pm
+++ b/Bugzilla/Search/Quicksearch.pm
@@ -159,6 +159,7 @@ sub quicksearch {
# It's no alias either, so it's a more complex query.
my $legal_statuses = get_legal_field_values('bug_status');
my $legal_resolutions = get_legal_field_values('resolution');
+ my $legal_priorities = get_legal_field_values('priority');
# Globally translate " AND ", " OR ", " NOT " to space, pipe, dash.
$searchstring =~ s/\s+AND\s+/ /g;
@@ -313,9 +314,24 @@ sub quicksearch {
$word, $negate);
}
# Priority
- elsif ($word =~ m/^[pP]([1-5](-[1-5])?)$/) {
- addChart('priority', 'regexp',
- "[$1]", $negate);
+ elsif (grep { lc($_) eq lc($word) }
+ @$legal_priorities)
+ {
+ addChart('priority', 'equals', $word, $negate);
+ }
+ # P1-5 Syntax
+ elsif ($word =~ m/^P(\d+)(?:-(\d+))?$/i) {
+ my $start = $1 - 1;
+ $start = 0 if $start < 0;
+ my $end = $2 - 1;
+ $end = scalar(@$legal_priorities) - 1
+ if $end > (scalar @$legal_priorities - 1);
+ my $prios = $legal_priorities->[$start];
+ if ($end) {
+ $prios = join(',', @$legal_priorities[$start..$end])
+ }
+ addChart('priority', 'anyexact', $prios,
+ $negate);
}
# Severity
elsif (grep({lc($word) eq substr($_, 0, 3)}