diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-08-19 17:33:07 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-08-19 17:35:46 -0300 |
commit | 2067f677df69200338d8d2b78f239759fc293fee (patch) | |
tree | cf7c0f575348e3cba1fdec0b223718d8261e843a /app/controllers/projects/starrers_controller.rb | |
parent | 50ff074e79a67a14abdd9f5fcce8d6c7729b179f (diff) | |
download | gitlab-ce-2067f677df69200338d8d2b78f239759fc293fee.tar.gz |
Fix N+1s queries while loading users
Diffstat (limited to 'app/controllers/projects/starrers_controller.rb')
-rw-r--r-- | app/controllers/projects/starrers_controller.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/controllers/projects/starrers_controller.rb b/app/controllers/projects/starrers_controller.rb index e4093bed0ef..4efe956e973 100644 --- a/app/controllers/projects/starrers_controller.rb +++ b/app/controllers/projects/starrers_controller.rb @@ -5,11 +5,11 @@ class Projects::StarrersController < Projects::ApplicationController def index @starrers = UsersStarProjectsFinder.new(@project, params, current_user: @current_user).execute + @sort = params[:sort].presence || sort_value_name + @starrers = @starrers.preload_users.sort_by_attribute(@sort).page(params[:page]) @public_count = @project.starrers.with_public_profile.size @total_count = @project.starrers.size @private_count = @total_count - @public_count - @sort = params[:sort].presence || sort_value_name - @starrers = @starrers.sort_by_attribute(@sort).page(params[:page]) end private |