Commit cea178da authored by Winnie Hellmann's avatar Winnie Hellmann Committed by Phil Hughes

Extract recentSearchesStorageKeys from FilteredSearchManager

(cherry picked from commit a4d0b2435ff132da9bb238fea95672a6ddfd084d)
parent 36d1d908
import _ from 'underscore'; import _ from 'underscore';
import { getParameterByName, getUrlParamsArray } from '~/lib/utils/common_utils'; import { getParameterByName, getUrlParamsArray } from '~/lib/utils/common_utils';
import IssuableFilteredSearchTokenKeys from '~/filtered_search/issuable_filtered_search_token_keys'; import IssuableFilteredSearchTokenKeys from '~/filtered_search/issuable_filtered_search_token_keys';
import recentSearchesStorageKeys from 'ee_else_ce/filtered_search/recent_searches_storage_keys';
import { visitUrl } from '../lib/utils/url_utility'; import { visitUrl } from '../lib/utils/url_utility';
import Flash from '../flash'; import Flash from '../flash';
import FilteredSearchContainer from './container'; import FilteredSearchContainer from './container';
...@@ -36,10 +37,11 @@ export default class FilteredSearchManager { ...@@ -36,10 +37,11 @@ export default class FilteredSearchManager {
this.tokensContainer = this.container.querySelector('.tokens-container'); this.tokensContainer = this.container.querySelector('.tokens-container');
this.filteredSearchTokenKeys = filteredSearchTokenKeys; this.filteredSearchTokenKeys = filteredSearchTokenKeys;
this.stateFiltersSelector = stateFiltersSelector; this.stateFiltersSelector = stateFiltersSelector;
this.recentsStorageKeyNames = {
issues: 'issue-recent-searches', const { multipleAssignees } = this.filteredSearchInput.dataset;
merge_requests: 'merge-request-recent-searches', if (multipleAssignees && this.filteredSearchTokenKeys.enableMultipleAssignees) {
}; this.filteredSearchTokenKeys.enableMultipleAssignees();
}
this.recentSearchesStore = new RecentSearchesStore({ this.recentSearchesStore = new RecentSearchesStore({
isLocalStorageAvailable: RecentSearchesService.isAvailable(), isLocalStorageAvailable: RecentSearchesService.isAvailable(),
...@@ -51,7 +53,7 @@ export default class FilteredSearchManager { ...@@ -51,7 +53,7 @@ export default class FilteredSearchManager {
const fullPath = this.searchHistoryDropdownElement const fullPath = this.searchHistoryDropdownElement
? this.searchHistoryDropdownElement.dataset.fullPath ? this.searchHistoryDropdownElement.dataset.fullPath
: 'project'; : 'project';
const recentSearchesKey = `${fullPath}-${this.recentsStorageKeyNames[this.page]}`; const recentSearchesKey = `${fullPath}-${recentSearchesStorageKeys[this.page]}`;
this.recentSearchesService = new RecentSearchesService(recentSearchesKey); this.recentSearchesService = new RecentSearchesService(recentSearchesKey);
} }
......
export default {
issues: 'issue-recent-searches',
merge_requests: 'merge-request-recent-searches',
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment