Commit d84a42bd authored by Simon Knox's avatar Simon Knox Committed by Oswaldo Ferreira

only hide board config labels

parent cb61fd1d
......@@ -87,7 +87,10 @@ $(() => {
Store.filter.path = [querystring].concat(
Store.filter.path.split('&').filter(param => param.match(new RegExp(`^${key}=(.*)$`, 'g')) === null)
).join('&');
this.cantEdit.push(tokenName);
this.cantEdit.push({
tokenName,
value,
});
};
updateFilterPath('milestone_title', this.milestoneTitle, 'milestone');
......@@ -104,7 +107,10 @@ $(() => {
filterPath.push(param);
}
this.cantEdit.push('label');
this.cantEdit.push({
tokenName: 'label',
value: label.title,
});
});
Store.filter.path = filterPath.join('&');
......
......@@ -12,6 +12,7 @@ export default class FilteredSearchBoards extends gl.FilteredSearchManager {
// instead or reloading the page, we just re-fire the list ajax requests
this.isHandledAsync = true;
this.cantEdit = cantEdit;
this.hiddenTokenNames = cantEdit.map(i => i.tokenName);
}
updateObject(path) {
......@@ -42,7 +43,10 @@ export default class FilteredSearchBoards extends gl.FilteredSearchManager {
this.filteredSearchInput.dispatchEvent(new Event('input'));
}
canEdit(tokenName) {
return this.cantEdit.indexOf(tokenName) === -1;
canEdit(tokenName, tokenValue) {
if (tokenValue && this.hiddenTokenNames.includes(tokenName)) {
return this.cantEdit.findIndex(i => i.tokenName === tokenName && i.value === tokenValue) === -1;
}
return this.hiddenTokenNames.indexOf(tokenName) === -1;
}
}
......@@ -481,7 +481,7 @@ class FilteredSearchManager {
}
hasFilteredSearch = true;
const canEdit = this.canEdit && this.canEdit(sanitizedKey);
const canEdit = this.canEdit && this.canEdit(sanitizedKey, sanitizedValue);
gl.FilteredSearchVisualTokens.addFilterVisualToken(
sanitizedKey,
`${symbol}${quotationsToUse}${sanitizedValue}${quotationsToUse}`,
......
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