diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 04:45:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 04:45:44 +0300 |
commit | 85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch) | |
tree | 9160f299afd8c80c038f08e1545be119f5e3f1e1 /app/finders/issuable_finder.rb | |
parent | 15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff) |
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
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) |