summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2019-08-14 17:29:41 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2019-08-15 14:34:16 -0300
commit38ba59bedd8b7e2f1a4de08725d6e000bf4fde42 (patch)
tree819858b4be2bc9226a5a3738df1a4a057731621f /app
parent903281454277805813eefd200d4279c6c4426a70 (diff)
downloadgitlab-ce-38ba59bedd8b7e2f1a4de08725d6e000bf4fde42.tar.gz
Fix starrers counters after searching
Diffstat (limited to 'app')
-rw-r--r--app/controllers/projects/starrers_controller.rb18
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