Commit 23fb465c authored by Yorick Peterse's avatar Yorick Peterse

Merge branch 'ab-37125-assigned-issues-query' into 'master'

Reduce complexity of issuable finder query.

Closes #37125

See merge request gitlab-org/gitlab-ce!18219
parents 9d220da8 cdfe437e
...@@ -159,7 +159,10 @@ class IssuableFinder ...@@ -159,7 +159,10 @@ class IssuableFinder
finder_options = { include_subgroups: params[:include_subgroups], only_owned: true } finder_options = { include_subgroups: params[:include_subgroups], only_owned: true }
GroupProjectsFinder.new(group: group, current_user: current_user, options: finder_options).execute GroupProjectsFinder.new(group: group, current_user: current_user, options: finder_options).execute
else else
ProjectsFinder.new(current_user: current_user, project_ids_relation: item_project_ids(items)).execute opts = { current_user: current_user }
opts[:project_ids_relation] = item_project_ids(items) if items
ProjectsFinder.new(opts).execute
end end
@projects = projects.with_feature_available_for_user(klass, current_user).reorder(nil) @projects = projects.with_feature_available_for_user(klass, current_user).reorder(nil)
...@@ -316,9 +319,9 @@ class IssuableFinder ...@@ -316,9 +319,9 @@ class IssuableFinder
def by_project(items) def by_project(items)
items = items =
if project? if project?
items.of_projects(projects(items)).references_project items.of_projects(projects).references_project
elsif projects(items) elsif projects
items.merge(projects(items).reorder(nil)).join_project items.merge(projects.reorder(nil)).join_project
else else
items.none items.none
end end
......
---
title: Reduce complexity of issuable finder query.
merge_request: 18219
author:
type: performance
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