Reuse query from ProjectsFinder to get projects accessible to current user.
This commit is contained in:
parent
90ced487f2
commit
0e1d440805
|
@ -7,9 +7,7 @@ class Projects::ForksController < Projects::ApplicationController
|
||||||
base_query = project.forks.includes(:creator)
|
base_query = project.forks.includes(:creator)
|
||||||
|
|
||||||
@forks = if current_user
|
@forks = if current_user
|
||||||
base_query.where('projects.visibility_level IN (?) OR projects.id IN (?)',
|
base_query.merge(ProjectsFinder.new.execute(current_user))
|
||||||
Project.public_and_internal_levels,
|
|
||||||
current_user.authorized_projects.pluck(:id))
|
|
||||||
else
|
else
|
||||||
base_query.where('projects.visibility_level = ?', Project::PUBLIC)
|
base_query.where('projects.visibility_level = ?', Project::PUBLIC)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue