Commit f42e661a authored by Miguel Rincon's avatar Miguel Rincon

Remove `legacySpacesDecode` from urlQueryToFilter

Remove `legacySpacesDecode` from urlQueryToFilter and remove it's
usages in analytics.
parent 23716539
...@@ -177,14 +177,10 @@ function filteredSearchTermValue(value) { ...@@ -177,14 +177,10 @@ function filteredSearchTermValue(value) {
* @param {Object} options * @param {Object} options
* @param {String} [options.filteredSearchTermKey] if set, a FILTERED_SEARCH_TERM filter is created to this parameter. `'search'` is suggested * @param {String} [options.filteredSearchTermKey] if set, a FILTERED_SEARCH_TERM filter is created to this parameter. `'search'` is suggested
* @param {String[]} [options.filterNamesAllowList] if set, only this list of filters names is mapped * @param {String[]} [options.filterNamesAllowList] if set, only this list of filters names is mapped
* @param {Boolean} [options.legacySpacesDecode] if set to true, plus symbols (+) are not encoded as spaces.
* @return {Object} filter object with filter names and their values * @return {Object} filter object with filter names and their values
*/ */
export function urlQueryToFilter( export function urlQueryToFilter(query = '', { filteredSearchTermKey, filterNamesAllowList } = {}) {
query = '', const filters = queryToObject(query, { gatherArrays: true });
{ filteredSearchTermKey, filterNamesAllowList, legacySpacesDecode = false } = {},
) {
const filters = queryToObject(query, { gatherArrays: true, legacySpacesDecode });
return Object.keys(filters).reduce((memo, key) => { return Object.keys(filters).reduce((memo, key) => {
const value = filters[key]; const value = filters[key];
if (!value) { if (!value) {
......
...@@ -20,9 +20,7 @@ export default () => { ...@@ -20,9 +20,7 @@ export default () => {
labelsEndpoint: labelsPath, labelsEndpoint: labelsPath,
projectEndpoint: projectPath, projectEndpoint: projectPath,
}); });
const { milestone_title = null, label_name = [] } = urlQueryToFilter(window.location.search, { const { milestone_title = null, label_name = [] } = urlQueryToFilter(window.location.search);
legacySpacesDecode: true,
});
store.dispatch('filters/initialize', { store.dispatch('filters/initialize', {
selectedMilestone: milestone_title, selectedMilestone: milestone_title,
selectedLabelList: label_name, selectedLabelList: label_name,
......
...@@ -28,9 +28,7 @@ export default () => { ...@@ -28,9 +28,7 @@ export default () => {
sort, sort,
direction, direction,
page, page,
} = urlQueryToFilter(window.location.search, { } = urlQueryToFilter(window.location.search);
legacySpacesDecode: true,
});
store.dispatch('initializeCycleAnalytics', { store.dispatch('initializeCycleAnalytics', {
...initialData, ...initialData,
......
...@@ -35,9 +35,7 @@ export default () => { ...@@ -35,9 +35,7 @@ export default () => {
author_username = null, author_username = null,
milestone_title = null, milestone_title = null,
label_name = [], label_name = [],
} = urlQueryToFilter(window.location.search, { } = urlQueryToFilter(window.location.search);
legacySpacesDecode: true,
});
store.dispatch('filters/initialize', { store.dispatch('filters/initialize', {
selectedSourceBranch: source_branch_name, selectedSourceBranch: source_branch_name,
selectedTargetBranch: target_branch_name, selectedTargetBranch: target_branch_name,
......
...@@ -311,13 +311,6 @@ describe('urlQueryToFilter', () => { ...@@ -311,13 +311,6 @@ describe('urlQueryToFilter', () => {
}, },
{ filteredSearchTermKey: 'search' }, { filteredSearchTermKey: 'search' },
], ],
[
'search=my+terms',
{
[FILTERED_SEARCH_TERM]: [{ value: 'my+terms' }],
},
{ filteredSearchTermKey: 'search', legacySpacesDecode: true },
],
[ [
'search=my terms&foo=bar&nop=xxx', 'search=my terms&foo=bar&nop=xxx',
{ {
......
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