diff options
author | Bryce Johnson <bryce@gitlab.com> | 2017-09-06 14:44:59 -0400 |
---|---|---|
committer | Bryce Johnson <bryce@gitlab.com> | 2017-09-07 11:49:36 -0400 |
commit | 1bd4cd4441dc747c468e6651ff544dd24eb235da (patch) | |
tree | bc1e61b15df6bd4cbb35e5cb923088806b0e4fb7 /app/assets | |
parent | 5f6545f36cde706d1fbe7efc429b9c0d8273f96a (diff) | |
download | gitlab-ce-1bd4cd4441dc747c468e6651ff544dd24eb235da.tar.gz |
Backport getAllParams and other nav changes from service desk.
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/filtered_search/filtered_search_manager.js | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/app/assets/javascripts/filtered_search/filtered_search_manager.js b/app/assets/javascripts/filtered_search/filtered_search_manager.js index 038239bf466..9178fec085a 100644 --- a/app/assets/javascripts/filtered_search/filtered_search_manager.js +++ b/app/assets/javascripts/filtered_search/filtered_search_manager.js @@ -332,7 +332,14 @@ class FilteredSearchManager { const removeElements = []; [].forEach.call(this.tokensContainer.children, (t) => { - if (t.classList.contains('js-visual-token')) { + let canClearToken = t.classList.contains('js-visual-token'); + + if (canClearToken) { + const tokenKey = t.querySelector('.name').textContent.trim(); + canClearToken = this.canEdit && this.canEdit(tokenKey); + } + + if (canClearToken) { removeElements.push(t); } }); @@ -411,8 +418,14 @@ class FilteredSearchManager { }); } + // allows for modifying params array when a param can't be included in the URL (e.g. Service Desk) + getAllParams(urlParams) { + return this.modifyUrlParams ? this.modifyUrlParams(urlParams) : urlParams; + } + loadSearchParamsFromURL() { - const params = gl.utils.getUrlParamsArray(); + const urlParams = gl.utils.getUrlParamsArray(); + const params = this.getAllParams(urlParams); const usernameParams = this.getUsernameParams(); let hasFilteredSearch = false; |