Merge branch 'issue-boards-label-filtering' into 'master'

Fixed issue boards not filtering when URL params are encoded

Closes #32084

See merge request !11320
This commit is contained in:
Filipa Lacerda 2017-05-16 08:18:53 +00:00
commit 17806d7619
2 changed files with 14 additions and 1 deletions

View file

@ -135,7 +135,10 @@
gl.utils.getUrlParamsArray = function () {
// We can trust that each param has one & since values containing & will be encoded
// Remove the first character of search as it is always ?
return window.location.search.slice(1).split('&');
return window.location.search.slice(1).split('&').map((param) => {
const split = param.split('=');
return [decodeURI(split[0]), split[1]].join('=');
});
};
gl.utils.isMetaKey = function(e) {

View file

@ -41,6 +41,16 @@ require('~/lib/utils/common_utils');
const paramsArray = gl.utils.getUrlParamsArray();
expect(paramsArray[0][0] !== '?').toBe(true);
});
it('should decode params', () => {
history.pushState('', '', '?label_name%5B%5D=test');
expect(
gl.utils.getUrlParamsArray()[0],
).toBe('label_name[]=test');
history.pushState('', '', '?');
});
});
describe('gl.utils.handleLocationHash', () => {