summaryrefslogtreecommitdiff
path: root/app/helpers/merge_requests_helper.rb
diff options
context:
space:
mode:
authormhasbini <mohammad.hasbini@gmail.com>2017-04-27 01:04:07 +0300
committermhasbini <mohammad.hasbini@gmail.com>2017-04-27 01:04:07 +0300
commitccac05dd90cb5cfa9abbeb11a50f953541eb83bb (patch)
treeff721d7fddfa595a75b3e2594ab7b5af7590d47f /app/helpers/merge_requests_helper.rb
parent43fb9279ce39d51b1deceb5108560bf37b8d340d (diff)
downloadgitlab-ce-ccac05dd90cb5cfa9abbeb11a50f953541eb83bb.tar.gz
Fix 404 when upstream has disabled merge requests
Diffstat (limited to 'app/helpers/merge_requests_helper.rb')
-rw-r--r--app/helpers/merge_requests_helper.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/helpers/merge_requests_helper.rb b/app/helpers/merge_requests_helper.rb
index e347f61fb8d..2614cdfe90e 100644
--- a/app/helpers/merge_requests_helper.rb
+++ b/app/helpers/merge_requests_helper.rb
@@ -1,6 +1,6 @@
module MergeRequestsHelper
def new_mr_path_from_push_event(event)
- target_project = event.project.forked_from_project || event.project
+ target_project = event.project.default_merge_request_target
new_namespace_project_merge_request_path(
event.project.namespace,
event.project,
@@ -127,6 +127,10 @@ module MergeRequestsHelper
end
end
+ def target_projects(project)
+ [project, project.default_merge_request_target].uniq
+ end
+
def merge_request_button_visibility(merge_request, closed)
return 'hidden' if merge_request.closed? == closed || (merge_request.merged? == closed && !merge_request.closed?) || merge_request.closed_without_fork?
end