Commit 0e1d4408 authored by Rubén Dávila's avatar Rubén Dávila

Reuse query from ProjectsFinder to get projects accessible to current user.

parent 90ced487
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment