From: Dylan William Hardison Date: Mon, 1 Apr 2019 17:04:35 +0000 (-0400) Subject: Revert "Bug 1527053 - Can't search for "video" to find all relevant bugs" X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=19d1a0a1f84c23f313db9ec4e8c5dbf219800b8a;p=thirdparty%2Fbugzilla.git Revert "Bug 1527053 - Can't search for "video" to find all relevant bugs" This reverts commit 94fdf013a13bbba31f0e1bec38f5eb1304a7d2d0. --- diff --git a/Bugzilla/Search/Quicksearch.pm b/Bugzilla/Search/Quicksearch.pm index 6351820c4..c8317a100 100644 --- a/Bugzilla/Search/Quicksearch.pm +++ b/Bugzilla/Search/Quicksearch.pm @@ -149,6 +149,8 @@ sub quicksearch { _bug_numbers_only($searchstring); } else { + _handle_alias($searchstring); + # Retain backslashes and quotes, to know which strings are quoted, # and which ones are not. my @words = _parse_line('\s+', 1, $searchstring); @@ -344,6 +346,27 @@ sub _bug_numbers_only { } } +sub _handle_alias { + my $searchstring = shift; + if ($searchstring =~ /^([^,\s]+)$/) { + my $alias = $1; + + # We use this direct SQL because we want quicksearch to be VERY fast. + my $bug_id + = Bugzilla->dbh->selectrow_array(q{SELECT bug_id FROM bugs WHERE alias = ?}, + undef, $alias); + + # If the user cannot see the bug or if we are using a webservice, + # do not resolve its alias. + if ($bug_id && Bugzilla->user->can_see_bug($bug_id) && !i_am_webservice()) { + $alias = url_quote($alias); + print Bugzilla->cgi->redirect( + -uri => Bugzilla->localconfig->{urlbase} . "show_bug.cgi?id=$alias"); + exit; + } + } +} + sub _handle_status_and_resolution { my $word = shift; my $legal_statuses = get_legal_field_values('bug_status'); diff --git a/template/en/default/pages/quicksearch.html.tmpl b/template/en/default/pages/quicksearch.html.tmpl index d83e70309..38fb9c004 100644 --- a/template/en/default/pages/quicksearch.html.tmpl +++ b/template/en/default/pages/quicksearch.html.tmpl @@ -54,7 +54,7 @@

This is an overview of how to effectively use search in [% terms.Bugzilla %]. For more general information about [% terms.Bugzilla %] usage, including the jargon and shorthand that the Mozilla commmunity uses in [% terms.bug %] discussions, please look at - Introduction to + Introduction to [% terms.Bugzilla %] page on Wiki.m.o.

The Basics

@@ -71,7 +71,12 @@ and [% field_descs.longdesc FILTER html %] fields for your word or words.
  • Typing just a number in the search box will take - you directly to the [% terms.bug %] with that ID.
  • + you directly to the [% terms.bug %] with that ID. + [% IF Param('usebugaliases') %] + Also, just typing the alias of [% terms.abug %] + will take you to that [% terms.bug %]. + [% END %] +
  • Adding more terms narrows down the search, it does not expand it. (In other words, [% terms.Bugzilla %] searches for