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

23 lines
561 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 = {})
2022-03-02 08:16:31 +05:30
return ::Namespace.where(id: user.forkable_namespaces).sort_by_type unless options[:only_groups]
2020-11-24 15:15:51 +05:30
2022-03-02 08:16:31 +05:30
::Group.where(id: user.manageable_groups(include_groups_with_developer_maintainer_access: true))
2020-04-08 14:13:33 +05:30
end
# rubocop: enable CodeReuse/ActiveRecord
private
attr_reader :project, :user
end
2021-06-08 01:23:25 +05:30
ForkTargetsFinder.prepend_mod_with('ForkTargetsFinder')