Commit 10811a2f authored by Phil Hughes's avatar Phil Hughes

Stops milestone being editable by backspace

parent f6147d3e
...@@ -76,7 +76,7 @@ $(() => { ...@@ -76,7 +76,7 @@ $(() => {
gl.boardService = new BoardService(this.endpoint, this.bulkUpdatePath, this.boardId); gl.boardService = new BoardService(this.endpoint, this.bulkUpdatePath, this.boardId);
gl.boardsFilterManager = new FilteredSearchBoards(Store.filter, true); gl.boardsFilterManager = new FilteredSearchBoards(Store.filter, true, [(this.milestoneTitle ? 'milestone' : null)]);
}, },
mounted () { mounted () {
Store.disabled = this.disabled; Store.disabled = this.disabled;
......
export default class FilteredSearchBoards extends gl.FilteredSearchManager { export default class FilteredSearchBoards extends gl.FilteredSearchManager {
constructor(store, updateUrl = false) { constructor(store, updateUrl = false, cantEdit = []) {
super('boards'); super('boards');
this.store = store; this.store = store;
this.updateUrl = updateUrl; this.updateUrl = updateUrl;
this.isHandledAsync = true; this.isHandledAsync = true;
this.cantEdit = cantEdit;
} }
updateObject(path) { updateObject(path) {
...@@ -28,4 +29,10 @@ export default class FilteredSearchBoards extends gl.FilteredSearchManager { ...@@ -28,4 +29,10 @@ export default class FilteredSearchBoards extends gl.FilteredSearchManager {
// Get the placeholder back if search is empty // Get the placeholder back if search is empty
this.filteredSearchInput.dispatchEvent(new Event('input')); this.filteredSearchInput.dispatchEvent(new Event('input'));
} }
canEdit(token) {
const tokenName = token.querySelector('.name').textContent.trim();
return this.cantEdit.indexOf(tokenName) === -1;
}
} }
...@@ -84,6 +84,8 @@ ...@@ -84,6 +84,8 @@
const { lastVisualToken } = gl.FilteredSearchVisualTokens.getLastVisualTokenBeforeInput(); const { lastVisualToken } = gl.FilteredSearchVisualTokens.getLastVisualTokenBeforeInput();
if (this.filteredSearchInput.value === '' && lastVisualToken) { if (this.filteredSearchInput.value === '' && lastVisualToken) {
if (this.canEdit && !this.canEdit(lastVisualToken)) return;
this.filteredSearchInput.value = gl.FilteredSearchVisualTokens.getLastTokenPartial(); this.filteredSearchInput.value = gl.FilteredSearchVisualTokens.getLastTokenPartial();
gl.FilteredSearchVisualTokens.removeLastTokenPartial(); gl.FilteredSearchVisualTokens.removeLastTokenPartial();
} }
......
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