diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /app/finders/issuable_finder.rb | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'app/finders/issuable_finder.rb')
-rw-r--r-- | app/finders/issuable_finder.rb | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb index d1885b5ae08..086dadcf5b7 100644 --- a/app/finders/issuable_finder.rb +++ b/app/finders/issuable_finder.rb @@ -50,7 +50,7 @@ class IssuableFinder attr_reader :original_params attr_writer :parent - delegate(*%i[assignee milestones], to: :params) + delegate(*%i[milestones], to: :params) class << self def scalar_params @@ -148,7 +148,6 @@ class IssuableFinder # Negates all params found in `negatable_params` def filter_negated_items(items) - items = by_negated_assignee(items) items = by_negated_label(items) items = by_negated_milestone(items) items = by_negated_release(items) @@ -365,32 +364,21 @@ class IssuableFinder def by_author(items) Issuables::AuthorFilter.new( - items, params: original_params, or_filters_enabled: or_filters_enabled? - ).filter + ).filter(items) end def by_assignee(items) - if params.filter_by_no_assignee? - items.unassigned - elsif params.filter_by_any_assignee? - items.assigned - elsif params.assignee - items.assigned_to(params.assignee) - elsif params.assignee_id? || params.assignee_username? # assignee not found - items.none - else - items - end + assignee_filter.filter(items) end - def by_negated_assignee(items) - # We want CE users to be able to say "Issues not assigned to either PersonA nor PersonB" - if not_params.assignees.present? - items.not_assigned_to(not_params.assignees) - else - items + def assignee_filter + strong_memoize(:assignee_filter) do + Issuables::AssigneeFilter.new( + params: original_params, + or_filters_enabled: or_filters_enabled? + ) end end |