diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-20 18:38:24 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-20 18:38:24 +0000 |
commit | 983a0bba5d2a042c4a3bbb22432ec192c7501d82 (patch) | |
tree | b153cd387c14ba23bd5a07514c7c01fddf6a78a0 /app/controllers/explore/projects_controller.rb | |
parent | a2bddee2cdb38673df0e004d5b32d9f77797de64 (diff) | |
download | gitlab-ce-983a0bba5d2a042c4a3bbb22432ec192c7501d82.tar.gz |
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
Diffstat (limited to 'app/controllers/explore/projects_controller.rb')
-rw-r--r-- | app/controllers/explore/projects_controller.rb | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/app/controllers/explore/projects_controller.rb b/app/controllers/explore/projects_controller.rb index a8a76b47bbe..705a586d614 100644 --- a/app/controllers/explore/projects_controller.rb +++ b/app/controllers/explore/projects_controller.rb @@ -66,18 +66,21 @@ class Explore::ProjectsController < Explore::ApplicationController @total_starred_projects_count = ProjectsFinder.new(params: { starred: true }, current_user: current_user).execute end - # rubocop: disable CodeReuse/ActiveRecord def load_projects load_project_counts - projects = ProjectsFinder.new(current_user: current_user, params: params) - .execute - .includes(:route, :creator, :group, namespace: [:route, :owner]) - .page(params[:page]) - .without_count + projects = ProjectsFinder.new(current_user: current_user, params: params).execute + + projects = preload_associations(projects) + projects = projects.page(params[:page]).without_count prepare_projects_for_rendering(projects) end + + # rubocop: disable CodeReuse/ActiveRecord + def preload_associations(projects) + projects.includes(:route, :creator, :group, namespace: [:route, :owner]) + end # rubocop: enable CodeReuse/ActiveRecord def set_sorting @@ -110,3 +113,5 @@ class Explore::ProjectsController < Explore::ApplicationController end end end + +Explore::ProjectsController.prepend_if_ee('EE::Explore::ProjectsController') |