Revert "Redirect to change if query page has 1 result" This reverts commit 7d86034cc36cec0fc6bfe6311626b727d86e1064. Reason for revert: <The new behaviour is too general, should not apply for any query.> Change-Id: I716f5b31921dbf2a569e835b05821b1d52096531
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 a02f5f2..509537d 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,6 +28,11 @@ 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 = @@ -178,10 +183,15 @@ .then(changes => { changes = changes || []; if (this._query && changes.length === 1) { - // "Back"/"Forward" buttons work correctly only with - // opt_redirect options - GerritNav.navigateToChange(changes[0], null, null, null, true); - return; + 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; + } + } } this._changes = changes; this._loading = false;