Class: ForkTargetsFinder

Inherits:
Object
  • Object
show all
Defined in:
app/finders/fork_targets_finder.rb

Instance Method Summary collapse

Constructor Details

#initialize(project, user) ⇒ ForkTargetsFinder

Returns a new instance of ForkTargetsFinder.


4
5
6
7
# File 'app/finders/fork_targets_finder.rb', line 4

def initialize(project, user)
  @project = project
  @user = user
end

Instance Method Details

#execute(options = {}) ⇒ Object

rubocop: disable CodeReuse/ActiveRecord


10
11
12
13
14
# File 'app/finders/fork_targets_finder.rb', line 10

def execute(options = {})
  return ::Namespace.where(id: user.manageable_namespaces).sort_by_type unless options[:only_groups]

  ::Group.where(id: user.manageable_groups)
end