Commit fefb2413 authored by Paul Slaughter's avatar Paul Slaughter

Merge branch 'remove-group-release-filter' into 'master'

Resolve "Hide inoperable group search Releases filter - frontend"

See merge request gitlab-org/gitlab!50010
parents a7b9628b e75579b5
...@@ -93,4 +93,13 @@ export default class FilteredSearchTokenKeys { ...@@ -93,4 +93,13 @@ export default class FilteredSearchTokenKeys {
this.tokenKeys.push(confidentialToken); this.tokenKeys.push(confidentialToken);
this.tokenKeysWithAlternative.push(confidentialToken); this.tokenKeysWithAlternative.push(confidentialToken);
} }
removeTokensForKeys(...keys) {
const keysSet = new Set(keys);
this.tokenKeys = this.tokenKeys.filter(({ key }) => !keysSet.has(key));
this.tokenKeysWithAlternative = this.tokenKeysWithAlternative.filter(
({ key }) => !keysSet.has(key),
);
}
} }
...@@ -9,6 +9,7 @@ import initManualOrdering from '~/manual_ordering'; ...@@ -9,6 +9,7 @@ import initManualOrdering from '~/manual_ordering';
const ISSUE_BULK_UPDATE_PREFIX = 'issue_'; const ISSUE_BULK_UPDATE_PREFIX = 'issue_';
IssuableFilteredSearchTokenKeys.addExtraTokensForIssues(); IssuableFilteredSearchTokenKeys.addExtraTokensForIssues();
IssuableFilteredSearchTokenKeys.removeTokensForKeys('release');
issuableInitBulkUpdateSidebar.init(ISSUE_BULK_UPDATE_PREFIX); issuableInitBulkUpdateSidebar.init(ISSUE_BULK_UPDATE_PREFIX);
initIssuablesList(); initIssuablesList();
......
---
title: Hide inoperable group search Releases filter
merge_request: 50010
author:
type: fixed
...@@ -145,18 +145,11 @@ class IssuesFilteredSearchTokenKeysEE extends FilteredSearchTokenKeys { ...@@ -145,18 +145,11 @@ class IssuesFilteredSearchTokenKeysEE extends FilteredSearchTokenKeys {
} }
removeEpicToken() { removeEpicToken() {
this.removeToken(epicTokenKey); this.removeTokensForKeys(epicTokenKey.key);
} }
removeIterationToken() { removeIterationToken() {
this.removeToken(iterationTokenKey); this.removeTokensForKeys(iterationTokenKey.key);
}
removeToken(tokenKey) {
const index = this.tokenKeys.findIndex((token) => token.key === tokenKey.key);
if (index >= 0) {
this.tokenKeys.splice(index, 1);
}
} }
} }
......
...@@ -145,4 +145,25 @@ describe('Issues Filtered Search Token Keys', () => { ...@@ -145,4 +145,25 @@ describe('Issues Filtered Search Token Keys', () => {
expect(result).toEqual(conditions[0]); expect(result).toEqual(conditions[0]);
}); });
}); });
describe('removeTokensForKeys', () => {
let initTokenKeys;
beforeEach(() => {
initTokenKeys = [...IssuableFilteredSearchTokenKeys.get()];
});
it('should remove the tokenKeys corresponding to the given keys', () => {
const [firstTokenKey, secondTokenKey, ...restTokens] = initTokenKeys;
IssuableFilteredSearchTokenKeys.removeTokensForKeys(firstTokenKey.key, secondTokenKey.key);
expect(IssuableFilteredSearchTokenKeys.get()).toEqual(restTokens);
});
it('should do nothing when key is not found', () => {
IssuableFilteredSearchTokenKeys.removeTokensForKeys('bogus');
expect(IssuableFilteredSearchTokenKeys.get()).toEqual(initTokenKeys);
});
});
}); });
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