Fix filtered search so that labels selected from discussion notes display correctly
This commit is contained in:
parent
b55c1bc4b5
commit
cd13d5dc52
2 changed files with 20 additions and 1 deletions
|
@ -21,6 +21,15 @@
|
||||||
symbol: '~',
|
symbol: '~',
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
const alternativeTokenKeys = [{
|
||||||
|
key: 'label',
|
||||||
|
type: 'string',
|
||||||
|
param: 'name',
|
||||||
|
symbol: '~',
|
||||||
|
}];
|
||||||
|
|
||||||
|
const tokenKeysWithAlternative = tokenKeys.concat(alternativeTokenKeys);
|
||||||
|
|
||||||
const conditions = [{
|
const conditions = [{
|
||||||
url: 'assignee_id=0',
|
url: 'assignee_id=0',
|
||||||
tokenKey: 'assignee',
|
tokenKey: 'assignee',
|
||||||
|
@ -44,6 +53,10 @@
|
||||||
return tokenKeys;
|
return tokenKeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static getAlternatives() {
|
||||||
|
return alternativeTokenKeys;
|
||||||
|
}
|
||||||
|
|
||||||
static getConditions() {
|
static getConditions() {
|
||||||
return conditions;
|
return conditions;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +70,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
static searchByKeyParam(keyParam) {
|
static searchByKeyParam(keyParam) {
|
||||||
return tokenKeys.find((tokenKey) => {
|
return tokenKeysWithAlternative.find((tokenKey) => {
|
||||||
let tokenKeyParam = tokenKey.key;
|
let tokenKeyParam = tokenKey.key;
|
||||||
|
|
||||||
if (tokenKey.param) {
|
if (tokenKey.param) {
|
||||||
|
|
|
@ -72,6 +72,12 @@
|
||||||
const result = gl.FilteredSearchTokenKeys.searchByKeyParam(`${tokenKeys[0].key}_${tokenKeys[0].param}`);
|
const result = gl.FilteredSearchTokenKeys.searchByKeyParam(`${tokenKeys[0].key}_${tokenKeys[0].param}`);
|
||||||
expect(result).toEqual(tokenKeys[0]);
|
expect(result).toEqual(tokenKeys[0]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should return alternative tokenKey when found by key param', () => {
|
||||||
|
const tokenKeys = gl.FilteredSearchTokenKeys.getAlternatives();
|
||||||
|
const result = gl.FilteredSearchTokenKeys.searchByKeyParam(`${tokenKeys[0].key}_${tokenKeys[0].param}`);
|
||||||
|
expect(result).toEqual(tokenKeys[0]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('searchByConditionUrl', () => {
|
describe('searchByConditionUrl', () => {
|
||||||
|
|
Loading…
Reference in a new issue