diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-03-03 14:28:25 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-03-03 14:28:25 +0000 |
commit | 1cb4f810a5edb6118e06d735a6cd4bd14eb80320 (patch) | |
tree | 92cf544a67d40c6f2e9a3b7bdcaa502e2e48171a /app/controllers/projects | |
parent | 0ca056eb99a0231a7b85a8137343afb491d0ecce (diff) | |
parent | 49e4ef3b41ef635cf50e45c9c6b82d64f38c0ed7 (diff) | |
download | gitlab-ce-1cb4f810a5edb6118e06d735a6cd4bd14eb80320.tar.gz |
Merge branch 'issue_13648' into 'master'
Reuse query from ProjectsFinder to get projects accessible to current user.
Fixes #13648
This is a refactor to reuse the existing query from our `ProjectsFinder` class
See merge request !3049
Diffstat (limited to 'app/controllers/projects')
-rw-r--r-- | app/controllers/projects/forks_controller.rb | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/app/controllers/projects/forks_controller.rb b/app/controllers/projects/forks_controller.rb index a0835c9aad0..c71b83c89b7 100644 --- a/app/controllers/projects/forks_controller.rb +++ b/app/controllers/projects/forks_controller.rb @@ -6,14 +6,7 @@ class Projects::ForksController < Projects::ApplicationController def index base_query = project.forks.includes(:creator) - @forks = if current_user - base_query.where('projects.visibility_level IN (?) OR projects.id IN (?)', - Project.public_and_internal_levels, - current_user.authorized_projects.pluck(:id)) - 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 |