Commit 5b932caf authored by Paul Slaughter's avatar Paul Slaughter

Merge branch 'ss/encode-url-for-boards' into 'master'

Add encoding for url for board filtered search

See merge request gitlab-org/gitlab!80006
parents 03fc5f19 4e1e934b
<script> <script>
import { pickBy, isEmpty } from 'lodash'; import { pickBy, isEmpty, mapValues } from 'lodash';
import { mapActions } from 'vuex'; import { mapActions } from 'vuex';
import { getIdFromGraphQLId, isGid } from '~/graphql_shared/utils'; import { getIdFromGraphQLId, isGid } from '~/graphql_shared/utils';
import { updateHistory, setUrlParams } from '~/lib/utils/url_utility'; import { updateHistory, setUrlParams } from '~/lib/utils/url_utility';
...@@ -251,7 +251,8 @@ export default { ...@@ -251,7 +251,8 @@ export default {
); );
} }
return { return mapValues(
{
...notParams, ...notParams,
author_username: authorUsername, author_username: authorUsername,
'label_name[]': labelName, 'label_name[]': labelName,
...@@ -266,7 +267,20 @@ export default { ...@@ -266,7 +267,20 @@ export default {
my_reaction_emoji: myReactionEmoji, my_reaction_emoji: myReactionEmoji,
release_tag: releaseTag, release_tag: releaseTag,
confidential, confidential,
}; },
(value) => {
if (value || value === false) {
// note: need to check array for labels.
if (Array.isArray(value)) {
return value.map((valueItem) => encodeURIComponent(valueItem));
}
return encodeURIComponent(value);
}
return value;
},
);
}, },
}, },
created() { created() {
......
...@@ -120,7 +120,7 @@ describe('BoardFilteredSearch', () => { ...@@ -120,7 +120,7 @@ describe('BoardFilteredSearch', () => {
{ type: 'author', value: { data: 'root', operator: '=' } }, { type: 'author', value: { data: 'root', operator: '=' } },
{ type: 'assignee', value: { data: 'root', operator: '=' } }, { type: 'assignee', value: { data: 'root', operator: '=' } },
{ type: 'label', value: { data: 'label', operator: '=' } }, { type: 'label', value: { data: 'label', operator: '=' } },
{ type: 'label', value: { data: 'label2', operator: '=' } }, { type: 'label', value: { data: 'label&2', operator: '=' } },
{ type: 'milestone', value: { data: 'New Milestone', operator: '=' } }, { type: 'milestone', value: { data: 'New Milestone', operator: '=' } },
{ type: 'type', value: { data: 'INCIDENT', operator: '=' } }, { type: 'type', value: { data: 'INCIDENT', operator: '=' } },
{ type: 'weight', value: { data: '2', operator: '=' } }, { type: 'weight', value: { data: '2', operator: '=' } },
...@@ -134,7 +134,7 @@ describe('BoardFilteredSearch', () => { ...@@ -134,7 +134,7 @@ describe('BoardFilteredSearch', () => {
title: '', title: '',
replace: true, replace: true,
url: url:
'http://test.host/?author_username=root&label_name[]=label&label_name[]=label2&assignee_username=root&milestone_title=New+Milestone&iteration_id=3341&types=INCIDENT&weight=2&release_tag=v1.0.0', 'http://test.host/?author_username=root&label_name[]=label&label_name[]=label%262&assignee_username=root&milestone_title=New%20Milestone&iteration_id=3341&types=INCIDENT&weight=2&release_tag=v1.0.0',
}); });
}); });
......
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