gitlab-org--gitlab-foss/app/finders/move_to_project_finder.rb
Paco Guzman 03386633a4 Move to project dropdown with infinite scroll for better performance
Use just SQL to check is a user can admin_issue on a project

Tradeoff

- we duplicate how we check admin_issue in a SQL relation in the Ability class
2016-08-17 07:33:51 +02:00

14 lines
394 B
Ruby

class MoveToProjectFinder
def initialize(user)
@user = user
end
def execute(from_project, search: nil, offset_id: nil)
projects = @user.projects_where_can_admin_issues
projects = projects.search(search) if search.present?
projects = projects.excluding_project(from_project)
# to ask for Project#name_with_namespace
projects.includes(namespace: :owner)
end
end