Reuse query from ProjectsFinder to get projects accessible to current user.
This commit is contained in:
parent
90ced487f2
commit
0e1d440805
1 changed files with 1 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue