summaryrefslogtreecommitdiff
path: root/app/helpers/merge_requests_helper.rb
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2018-04-06 16:04:48 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2018-04-11 10:51:15 +0200
commitfe9389ba6c10e9addefc6e647f1476ff765236d9 (patch)
tree3649865d43ac65c7560bff8d179e0170c31aa8dc /app/helpers/merge_requests_helper.rb
parent12dd2b0cc0cf6dd8dc43ff8b8df8687268ba4af5 (diff)
downloadgitlab-ce-fe9389ba6c10e9addefc6e647f1476ff765236d9.tar.gz
Hide new mr from dropdown for archived projects
Diffstat (limited to 'app/helpers/merge_requests_helper.rb')
-rw-r--r--app/helpers/merge_requests_helper.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/helpers/merge_requests_helper.rb b/app/helpers/merge_requests_helper.rb
index fb4fe1c40b7..c19c5b9cc82 100644
--- a/app/helpers/merge_requests_helper.rb
+++ b/app/helpers/merge_requests_helper.rb
@@ -138,6 +138,18 @@ module MergeRequestsHelper
end
end
+ def merge_request_source_project_for_project(project = @project)
+ unless can?(current_user, :create_merge_request_in, project)
+ return nil
+ end
+
+ if can?(current_user, :create_merge_request_from, project)
+ project
+ else
+ current_user.fork_of(project)
+ end
+ end
+
def merge_params_ee(merge_request)
{}
end