Redirect to change if query page has 1 result Gerrit redirects user directly to the change if the query returns only 1 change. However this behaviour is limited only for changeId and changeNum. Remove this restriction so that behaviour applies for any query such as hashtag: or commit:. Change-Id: I391e6778337ee7ef58191594267a51d6f47872b7
diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-view/gr-change-list-view.js b/polygerrit-ui/app/elements/change-list/gr-change-list-view/gr-change-list-view.js index 509537d..a02f5f2 100644 --- a/polygerrit-ui/app/elements/change-list/gr-change-list-view/gr-change-list-view.js +++ b/polygerrit-ui/app/elements/change-list/gr-change-list-view/gr-change-list-view.js
@@ -28,11 +28,6 @@ import {page} from '../../../utils/page-wrapper-utils.js'; import {GerritNav} from '../../core/gr-navigation/gr-navigation.js'; -const LookupQueryPatterns = { - CHANGE_ID: /^\s*i?[0-9a-f]{7,40}\s*$/i, - CHANGE_NUM: /^\s*[1-9][0-9]*\s*$/g, -}; - const USER_QUERY_PATTERN = /^owner:\s?("[^"]+"|[^ ]+)$/; const REPO_QUERY_PATTERN = @@ -183,15 +178,10 @@ .then(changes => { changes = changes || []; if (this._query && changes.length === 1) { - for (const query in LookupQueryPatterns) { - if (LookupQueryPatterns.hasOwnProperty(query) && - this._query.match(LookupQueryPatterns[query])) { - // "Back"/"Forward" buttons work correctly only with - // opt_redirect options - GerritNav.navigateToChange(changes[0], null, null, null, true); - return; - } - } + // "Back"/"Forward" buttons work correctly only with + // opt_redirect options + GerritNav.navigateToChange(changes[0], null, null, null, true); + return; } this._changes = changes; this._loading = false;