Commit bfd5c93d authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch...

Merge branch '339480-remove-legacyspacesdecode-from-ee-app-assets-javascripts-analytics' into 'master'

Remove `legacySpacesDecode` from urlQueryToFilter

See merge request gitlab-org/gitlab!69098
parents f6efcfb4 f42e661a
......@@ -177,14 +177,10 @@ function filteredSearchTermValue(value) {
* @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.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
*/
export function urlQueryToFilter(
query = '',
{ filteredSearchTermKey, filterNamesAllowList, legacySpacesDecode = false } = {},
) {
const filters = queryToObject(query, { gatherArrays: true, legacySpacesDecode });
export function urlQueryToFilter(query = '', { filteredSearchTermKey, filterNamesAllowList } = {}) {
const filters = queryToObject(query, { gatherArrays: true });
return Object.keys(filters).reduce((memo, key) => {
const value = filters[key];
if (!value) {
......
......@@ -20,9 +20,7 @@ export default () => {
labelsEndpoint: labelsPath,
projectEndpoint: projectPath,
});
const { milestone_title = null, label_name = [] } = urlQueryToFilter(window.location.search, {
legacySpacesDecode: true,
});
const { milestone_title = null, label_name = [] } = urlQueryToFilter(window.location.search);
store.dispatch('filters/initialize', {
selectedMilestone: milestone_title,
selectedLabelList: label_name,
......
......@@ -28,9 +28,7 @@ export default () => {
sort,
direction,
page,
} = urlQueryToFilter(window.location.search, {
legacySpacesDecode: true,
});
} = urlQueryToFilter(window.location.search);
store.dispatch('initializeCycleAnalytics', {
...initialData,
......
......@@ -35,9 +35,7 @@ export default () => {
author_username = null,
milestone_title = null,
label_name = [],
} = urlQueryToFilter(window.location.search, {
legacySpacesDecode: true,
});
} = urlQueryToFilter(window.location.search);
store.dispatch('filters/initialize', {
selectedSourceBranch: source_branch_name,
selectedTargetBranch: target_branch_name,
......
......@@ -311,13 +311,6 @@ describe('urlQueryToFilter', () => {
},
{ filteredSearchTermKey: 'search' },
],
[
'search=my+terms',
{
[FILTERED_SEARCH_TERM]: [{ value: 'my+terms' }],
},
{ filteredSearchTermKey: 'search', legacySpacesDecode: true },
],
[
'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