diff options
author | Hiroyuki Sato <sathiroyuki@gmail.com> | 2019-03-09 12:22:58 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-03-09 12:22:58 +0000 |
commit | de784ac10516ec1e1c93d164f3d99b2ff09e5889 (patch) | |
tree | fd3e0a4d845545f2ffa72e82294394a2139a4e50 /app/assets/javascripts/filtered_search/filtered_search_manager.js | |
parent | 6908c5f70eb4d5d7e8ef28b43d73d71da9b2a0c3 (diff) | |
download | gitlab-ce-de784ac10516ec1e1c93d164f3d99b2ff09e5889.tar.gz |
Filter merge requests by target branch
Diffstat (limited to 'app/assets/javascripts/filtered_search/filtered_search_manager.js')
-rw-r--r-- | app/assets/javascripts/filtered_search/filtered_search_manager.js | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/app/assets/javascripts/filtered_search/filtered_search_manager.js b/app/assets/javascripts/filtered_search/filtered_search_manager.js index 33c82778c79..0c2e87521d9 100644 --- a/app/assets/javascripts/filtered_search/filtered_search_manager.js +++ b/app/assets/javascripts/filtered_search/filtered_search_manager.js @@ -504,14 +504,7 @@ export default class FilteredSearchManager { const match = this.filteredSearchTokenKeys.searchByKeyParam(keyParam); if (match) { - // Use lastIndexOf because the token key is allowed to contain underscore - // e.g. 'my_reaction' is the token key of 'my_reaction_emoji' - const lastIndexOf = keyParam.lastIndexOf('_'); - let sanitizedKey = lastIndexOf !== -1 ? keyParam.slice(0, lastIndexOf) : keyParam; - // Replace underscore with hyphen in the sanitizedkey. - // e.g. 'my_reaction' => 'my-reaction' - sanitizedKey = sanitizedKey.replace('_', '-'); - const { symbol } = match; + const { key, symbol } = match; let quotationsToUse = ''; if (sanitizedValue.indexOf(' ') !== -1) { @@ -520,10 +513,10 @@ export default class FilteredSearchManager { } hasFilteredSearch = true; - const canEdit = this.canEdit && this.canEdit(sanitizedKey, sanitizedValue); + const canEdit = this.canEdit && this.canEdit(key, sanitizedValue); const { uppercaseTokenName, capitalizeTokenValue } = match; FilteredSearchVisualTokens.addFilterVisualToken( - sanitizedKey, + key, `${symbol}${quotationsToUse}${sanitizedValue}${quotationsToUse}`, { canEdit, |