diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-09-20 17:41:11 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-10-07 11:46:23 +0200 |
commit | 70716a1292ca5910908ba37a9d113c8b5a221bb7 (patch) | |
tree | ebff7a1289e85444170669761fcd2233a5757d54 /app/finders | |
parent | d328007214786c7137c31d2c73e9ee76b025e6ed (diff) | |
download | gitlab-ce-70716a1292ca5910908ba37a9d113c8b5a221bb7.tar.gz |
Allow creating merge requests across forks of a project
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/merge_request_target_project_finder.rb | 18 |
1 files changed, 18 insertions, 0 deletions
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 |