From 70716a1292ca5910908ba37a9d113c8b5a221bb7 Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Wed, 20 Sep 2017 17:41:11 +0200 Subject: Allow creating merge requests across forks of a project --- app/finders/merge_request_target_project_finder.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 app/finders/merge_request_target_project_finder.rb (limited to 'app/finders') diff --git a/app/finders/merge_request_target_project_finder.rb b/app/finders/merge_request_target_project_finder.rb new file mode 100644 index 00000000000..508b53a52c1 --- /dev/null +++ b/app/finders/merge_request_target_project_finder.rb @@ -0,0 +1,18 @@ +class MergeRequestTargetProjectFinder + attr_reader :current_user, :source_project + + def initialize(current_user: nil, source_project:, params: {}) + @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) + .with_feature_available_for_user(:merge_requests, current_user) + else + Project.where(id: source_project) + end + end +end -- cgit v1.2.1