diff options
author | Stan Hu <stanhu@gmail.com> | 2019-08-16 20:34:27 +0000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-08-16 20:34:27 +0000 |
commit | 2dcb69c90342a5333e5701a1cd704ae738e9433b (patch) | |
tree | 1040407e118ac8dbb86c4e09a48651e65ddff134 /app/controllers | |
parent | 971e040c00a14d7fbdfed5f45d6978a2c6b4f4f5 (diff) | |
parent | 4596d5d1a2eb8f918f9f59d85aed53aa232f1fcf (diff) | |
download | gitlab-ce-2dcb69c90342a5333e5701a1cd704ae738e9433b.tar.gz |
Merge branch '66023-starrers-count-do-not-match-after-searching' into 'master'
Fix starrers counts after searching
See merge request gitlab-org/gitlab-ce!31823
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/projects/starrers_controller.rb | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/app/controllers/projects/starrers_controller.rb b/app/controllers/projects/starrers_controller.rb index c8facea1d70..e4093bed0ef 100644 --- a/app/controllers/projects/starrers_controller.rb +++ b/app/controllers/projects/starrers_controller.rb @@ -5,23 +5,9 @@ class Projects::StarrersController < Projects::ApplicationController def index @starrers = UsersStarProjectsFinder.new(@project, params, current_user: @current_user).execute - - # Normally the number of public starrers is equal to the number of visible - # starrers. We need to fix the counts in two cases: when the current user - # is an admin (and can see everything) and when the current user has a - # private profile and has starred the project (and can see itself). - @public_count = - if @current_user&.admin? - @starrers.with_public_profile.count - elsif @current_user&.private_profile && has_starred_project?(@starrers) - @starrers.size - 1 - else - @starrers.size - end - - @total_count = @project.starrers.size + @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 |