Commit 57e6a98c authored by Sean McGivern's avatar Sean McGivern

Simplify issuable finder queries

We had `item_project_ids` to help make slow queries on the dashboard faster, but
this isn't necessary any more - the queries are plenty fast, and we forbid
searching the dashboard without filters.
parent 17e30a32
...@@ -95,12 +95,6 @@ module IssuableCollections ...@@ -95,12 +95,6 @@ module IssuableCollections
elsif @group elsif @group
@filter_params[:group_id] = @group.id @filter_params[:group_id] = @group.id
@filter_params[:include_subgroups] = true @filter_params[:include_subgroups] = true
else
# TODO: this filter ignore issues/mr created in public or
# internal repos where you are not a member. Enable this filter
# or improve current implementation to filter only issues you
# created or assigned or mentioned
# @filter_params[:authorized_only] = true
end end
@filter_params.permit(finder_type.valid_params) @filter_params.permit(finder_type.valid_params)
......
...@@ -159,10 +159,7 @@ class IssuableFinder ...@@ -159,10 +159,7 @@ 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
opts = { current_user: current_user } ProjectsFinder.new(current_user: current_user).execute
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)
......
...@@ -136,8 +136,4 @@ class IssuesFinder < IssuableFinder ...@@ -136,8 +136,4 @@ class IssuesFinder < IssuableFinder
items items
end end
end end
def item_project_ids(items)
items&.reorder(nil)&.select(:project_id)
end
end end
...@@ -56,8 +56,4 @@ class MergeRequestsFinder < IssuableFinder ...@@ -56,8 +56,4 @@ class MergeRequestsFinder < IssuableFinder
items.where(target_branch: target_branch) items.where(target_branch: target_branch)
end end
def item_project_ids(items)
items&.reorder(nil)&.select(:target_project_id)
end
end end
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