summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRubén Dávila <rdavila84@gmail.com>2016-03-02 12:35:56 -0500
committerRubén Dávila <rdavila84@gmail.com>2016-03-02 12:35:56 -0500
commit49e4ef3b41ef635cf50e45c9c6b82d64f38c0ed7 (patch)
treea49788630e67057f7b5ed9c5242b289d9f070a25 /app
parent0e1d440805424529a7e40c30c4847e6f4cc7a0f0 (diff)
downloadgitlab-ce-49e4ef3b41ef635cf50e45c9c6b82d64f38c0ed7.tar.gz
Add specs to ForksController#index.issue_13648
* Also refactor query to get projects accessible for current user. ProjectsFinder actually return public projects when no user is passed.
Diffstat (limited to 'app')
-rw-r--r--app/controllers/projects/forks_controller.rb7
1 files changed, 1 insertions, 6 deletions
diff --git a/app/controllers/projects/forks_controller.rb b/app/controllers/projects/forks_controller.rb
index c71ecf4e2bb..c71b83c89b7 100644
--- a/app/controllers/projects/forks_controller.rb
+++ b/app/controllers/projects/forks_controller.rb
@@ -6,12 +6,7 @@ class Projects::ForksController < Projects::ApplicationController
def index
base_query = project.forks.includes(:creator)
- @forks = if current_user
- base_query.merge(ProjectsFinder.new.execute(current_user))
- else
- base_query.where('projects.visibility_level = ?', Project::PUBLIC)
- end
-
+ @forks = base_query.merge(ProjectsFinder.new.execute(current_user))
@total_forks_count = base_query.size
@private_forks_count = @total_forks_count - @forks.size
@public_forks_count = @total_forks_count - @private_forks_count