2017-09-20 11:41:11 -04:00
|
|
|
class MergeRequestTargetProjectFinder
|
2017-12-11 09:21:06 -05:00
|
|
|
include FinderMethods
|
|
|
|
|
2017-09-20 11:41:11 -04:00
|
|
|
attr_reader :current_user, :source_project
|
|
|
|
|
2017-09-21 12:34:32 -04:00
|
|
|
def initialize(current_user: nil, source_project:)
|
2017-09-20 11:41:11 -04:00
|
|
|
@current_user = current_user
|
|
|
|
@source_project = source_project
|
|
|
|
end
|
|
|
|
|
|
|
|
def execute
|
|
|
|
if @source_project.fork_network
|
|
|
|
@source_project.fork_network.projects
|
|
|
|
.public_or_visible_to_user(current_user)
|
2018-04-06 06:47:52 -04:00
|
|
|
.non_archived
|
2017-09-20 11:41:11 -04:00
|
|
|
.with_feature_available_for_user(:merge_requests, current_user)
|
|
|
|
else
|
|
|
|
Project.where(id: source_project)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|