]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Revert "Bug 1527053 - Can't search for "video" to find all relevant bugs"
authorDylan William Hardison <dylan@hardison.net>
Mon, 1 Apr 2019 17:04:35 +0000 (13:04 -0400)
committerDylan William Hardison <dylan@hardison.net>
Mon, 1 Apr 2019 17:04:35 +0000 (13:04 -0400)
This reverts commit 94fdf013a13bbba31f0e1bec38f5eb1304a7d2d0.

Bugzilla/Search/Quicksearch.pm
template/en/default/pages/quicksearch.html.tmpl

index 6351820c4c6e243360768e338c3d864b97dbfb3f..c8317a1006807edcdfe4e95a51b67e11aba5a61d 100644 (file)
@@ -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');
index d83e7030932a30ca16a60b9862baa7999ba13f62..38fb9c00401978948e16e2a6b8a269addde8bfe8 100644 (file)
@@ -54,7 +54,7 @@
 <p>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
-  <a href="https://wiki.mozilla.org/Introduction_to_B[% %]ugzilla">Introduction to
+  <a href="https://wiki.mozilla.org/Introduction_to_B[% %]ugzilla">Introduction to 
   [% terms.Bugzilla %]</a> page on <a href="https://wiki.mozilla.org/">Wiki.m.o</a>.</p>
 
 <h2 id="basics">The Basics</h2>
     and [% field_descs.longdesc FILTER html %] fields for your word or words.</li>
 
   <li>Typing just a <strong>number</strong> in the search box will take
-    you directly to the [% terms.bug %] with that ID.</li>
+    you directly to the [% terms.bug %] with that ID.
+    [% IF Param('usebugaliases') %]
+      Also, just typing the <strong>alias</strong> of [% terms.abug %]
+      will take you to that [% terms.bug %].
+    [% END %]
+  </li>
 
   <li>Adding more terms <strong>narrows down</strong> the search, it does not
      expand it. (In other words, [% terms.Bugzilla %] searches for