summaryrefslogtreecommitdiff
path: root/app/controllers/dashboard/projects_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/dashboard/projects_controller.rb')
-rw-r--r--app/controllers/dashboard/projects_controller.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/app/controllers/dashboard/projects_controller.rb b/app/controllers/dashboard/projects_controller.rb
index 039991e07a2..c173d7d2310 100644
--- a/app/controllers/dashboard/projects_controller.rb
+++ b/app/controllers/dashboard/projects_controller.rb
@@ -61,22 +61,24 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
end
end
- # rubocop: disable CodeReuse/ActiveRecord
def load_projects(finder_params)
@total_user_projects_count = ProjectsFinder.new(params: { non_public: true }, current_user: current_user).execute
@total_starred_projects_count = ProjectsFinder.new(params: { starred: true }, current_user: current_user).execute
finder_params[:use_cte] = true if use_cte_for_finder?
- projects = ProjectsFinder
- .new(params: finder_params, current_user: current_user)
- .execute
- .includes(:route, :creator, :group, namespace: [:route, :owner])
- .preload(:project_feature)
- .page(finder_params[:page])
+ projects = ProjectsFinder.new(params: finder_params, current_user: current_user).execute
+
+ projects = preload_associations(projects)
+ projects = projects.page(finder_params[:page])
prepare_projects_for_rendering(projects)
end
+
+ # rubocop: disable CodeReuse/ActiveRecord
+ def preload_associations(projects)
+ projects.includes(:route, :creator, :group, namespace: [:route, :owner]).preload(:project_feature)
+ end
# rubocop: enable CodeReuse/ActiveRecord
def use_cte_for_finder?