diff options
author | Rubén Dávila <rdavila84@gmail.com> | 2016-03-01 11:45:30 -0500 |
---|---|---|
committer | Rubén Dávila <rdavila84@gmail.com> | 2016-03-01 12:48:09 -0500 |
commit | 0e1d440805424529a7e40c30c4847e6f4cc7a0f0 (patch) | |
tree | f323cc547db073f80e3be1caf8a31b6e794763b0 | |
parent | 90ced487f2e8a6252864f9ac8821c2de06be9ced (diff) | |
download | gitlab-ce-0e1d440805424529a7e40c30c4847e6f4cc7a0f0.tar.gz |
Reuse query from ProjectsFinder to get projects accessible to current user.
-rw-r--r-- | app/controllers/projects/forks_controller.rb | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/app/controllers/projects/forks_controller.rb b/app/controllers/projects/forks_controller.rb index a0835c9aad0..c71ecf4e2bb 100644 --- a/app/controllers/projects/forks_controller.rb +++ b/app/controllers/projects/forks_controller.rb @@ -7,9 +7,7 @@ class Projects::ForksController < Projects::ApplicationController 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)) + base_query.merge(ProjectsFinder.new.execute(current_user)) else base_query.where('projects.visibility_level = ?', Project::PUBLIC) end |