diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-13 21:08:33 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-13 21:08:33 +0300 |
commit | 9adada1187b920547a57b4bb406c3e3c55436bf1 (patch) | |
tree | 6c246b5f6acd81f24071f654a41df5081d671df1 /app/assets/javascripts/issues | |
parent | 7eca3f56625526ffa7f263c1fef0fcea34de8ca6 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/issues')
-rw-r--r-- | app/assets/javascripts/issues/list/constants.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/issues/list/utils.js | 19 |
2 files changed, 15 insertions, 8 deletions
diff --git a/app/assets/javascripts/issues/list/constants.js b/app/assets/javascripts/issues/list/constants.js index 4541191730a..0795df10a7c 100644 --- a/app/assets/javascripts/issues/list/constants.js +++ b/app/assets/javascripts/issues/list/constants.js @@ -56,6 +56,7 @@ export const ISSUE_REFERENCE = /^#\d+$/; export const MAX_LIST_SIZE = 10; export const PAGE_SIZE = 20; export const PAGE_SIZE_MANUAL = 100; +export const PARAM_ASSIGNEE_ID = 'assignee_id'; export const PARAM_PAGE_AFTER = 'page_after'; export const PARAM_PAGE_BEFORE = 'page_before'; export const PARAM_SORT = 'sort'; @@ -113,7 +114,8 @@ export const URL_PARAM = 'urlParam'; export const NORMAL_FILTER = 'normalFilter'; export const SPECIAL_FILTER = 'specialFilter'; export const ALTERNATIVE_FILTER = 'alternativeFilter'; -export const SPECIAL_FILTER_VALUES = [ + +export const specialFilterValues = [ FILTER_NONE, FILTER_ANY, FILTER_CURRENT, diff --git a/app/assets/javascripts/issues/list/utils.js b/app/assets/javascripts/issues/list/utils.js index 2aa74dd2ea9..3ca93069628 100644 --- a/app/assets/javascripts/issues/list/utils.js +++ b/app/assets/javascripts/issues/list/utils.js @@ -1,5 +1,6 @@ import { createTerm } from '@gitlab/ui/src/components/base/filtered_search/filtered_search_utils'; import { isPositiveInteger } from '~/lib/utils/number_utils'; +import { getParameterByName } from '~/lib/utils/url_utility'; import { __ } from '~/locale'; import { FILTERED_SEARCH_TERM, @@ -21,13 +22,14 @@ import { NORMAL_FILTER, PAGE_SIZE, PAGE_SIZE_MANUAL, + PARAM_ASSIGNEE_ID, POPULARITY_ASC, POPULARITY_DESC, PRIORITY_ASC, PRIORITY_DESC, RELATIVE_POSITION_ASC, SPECIAL_FILTER, - SPECIAL_FILTER_VALUES, + specialFilterValues, TITLE_ASC, TITLE_DESC, TOKEN_TYPE_ASSIGNEE, @@ -204,16 +206,19 @@ export const getFilterTokens = (locationSearch) => { return tokens.length ? tokens : [createTerm()]; }; -const getFilterType = (data, tokenType = '') => - SPECIAL_FILTER_VALUES.includes(data) || - (tokenType === TOKEN_TYPE_ASSIGNEE && isPositiveInteger(data)) - ? SPECIAL_FILTER - : NORMAL_FILTER; +const getFilterType = (data, tokenType = '') => { + const isAssigneeIdParam = + tokenType === TOKEN_TYPE_ASSIGNEE && + isPositiveInteger(data) && + getParameterByName(PARAM_ASSIGNEE_ID) === data; + + return specialFilterValues.includes(data) || isAssigneeIdParam ? SPECIAL_FILTER : NORMAL_FILTER; +}; const wildcardTokens = [TOKEN_TYPE_ITERATION, TOKEN_TYPE_MILESTONE, TOKEN_TYPE_RELEASE]; const isWildcardValue = (tokenType, value) => - wildcardTokens.includes(tokenType) && SPECIAL_FILTER_VALUES.includes(value); + wildcardTokens.includes(tokenType) && specialFilterValues.includes(value); const requiresUpperCaseValue = (tokenType, value) => tokenType === TOKEN_TYPE_TYPE || isWildcardValue(tokenType, value); |