diff options
author | Rubén Dávila <rdavila84@gmail.com> | 2016-03-02 20:35:56 +0300 |
---|---|---|
committer | Rubén Dávila <rdavila84@gmail.com> | 2016-03-02 20:35:56 +0300 |
commit | 49e4ef3b41ef635cf50e45c9c6b82d64f38c0ed7 (patch) | |
tree | a49788630e67057f7b5ed9c5242b289d9f070a25 /app/controllers/projects/forks_controller.rb | |
parent | 0e1d440805424529a7e40c30c4847e6f4cc7a0f0 (diff) |
Add specs to ForksController#index.
* Also refactor query to get projects accessible for current user.
ProjectsFinder actually return public projects when no user is passed.
Diffstat (limited to 'app/controllers/projects/forks_controller.rb')
-rw-r--r-- | app/controllers/projects/forks_controller.rb | 7 |
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 |