diff options
Diffstat (limited to 'app/finders/issuable_finder.rb')
-rw-r--r-- | app/finders/issuable_finder.rb | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb index 5cdc22fd873..f13dc8c2451 100644 --- a/app/finders/issuable_finder.rb +++ b/app/finders/issuable_finder.rb @@ -37,12 +37,14 @@ class IssuableFinder include FinderMethods include CreatedAtFilter include Gitlab::Utils::StrongMemoize + prepend OptimizedIssuableLabelFilter requires_cross_project_access unless: -> { params.project? } NEGATABLE_PARAMS_HELPER_KEYS = %i[project_id scope status include_subgroups].freeze attr_accessor :current_user, :params + attr_writer :parent delegate(*%i[assignee milestones], to: :params) @@ -103,8 +105,8 @@ class IssuableFinder items = filter_negated_items(items) # This has to be last as we use a CTE as an optimization fence - # for counts by passing the force_cte param and enabling the - # attempt_group_search_optimizations feature flag + # for counts by passing the force_cte param and passing the + # attempt_group_search_optimizations param # https://www.postgresql.org/docs/current/static/queries-with.html items = by_search(items) @@ -203,8 +205,26 @@ class IssuableFinder end end + def parent_param=(obj) + @parent = obj + params[parent_param] = parent if parent + end + + def parent_param + case parent + when Project + :project_id + when Group + :group_id + else + raise "Unexpected parent: #{parent.class}" + end + end + private + attr_reader :parent + def not_params strong_memoize(:not_params) do params_class.new(params[:not].dup, current_user, klass).tap do |not_params| @@ -229,13 +249,11 @@ class IssuableFinder end def attempt_group_search_optimizations? - params[:attempt_group_search_optimizations] && - Feature.enabled?(:attempt_group_search_optimizations, default_enabled: true) + params[:attempt_group_search_optimizations] end def attempt_project_search_optimizations? - params[:attempt_project_search_optimizations] && - Feature.enabled?(:attempt_project_search_optimizations, default_enabled: true) + params[:attempt_project_search_optimizations] end def count_key(value) |