debian-mirror-gitlab/app/finders/fork_targets_finder.rb

23 lines
509 B
Ruby
Raw Normal View History

2020-04-08 14:13:33 +05:30
# frozen_string_literal: true
class ForkTargetsFinder
def initialize(project, user)
@project = project
@user = user
end
# rubocop: disable CodeReuse/ActiveRecord
2020-11-24 15:15:51 +05:30
def execute(options = {})
return ::Namespace.where(id: user.manageable_namespaces).sort_by_type unless options[:only_groups]
::Group.where(id: user.manageable_groups)
2020-04-08 14:13:33 +05:30
end
# rubocop: enable CodeReuse/ActiveRecord
private
attr_reader :project, :user
end
ForkTargetsFinder.prepend_if_ee('EE::ForkTargetsFinder')