Commit 8b284a51 authored by Nick Thomas's avatar Nick Thomas 💃

Merge branch 'dm-submodule-helper-routing' into 'master'

Ensure SubmoduleHelper works outside view context

Closes #64833

See merge request gitlab-org/gitlab-ce!31005
parents b40630e1 26ac53b3
Pipeline #72269194 passed with stages
in 89 minutes and 44 seconds
......@@ -34,8 +34,8 @@ module SubmoduleHelper
project.sub!(/\.git\z/, '')
if self_url?(url, namespace, project)
[namespace_project_path(namespace, project),
namespace_project_tree_path(namespace, project, submodule_item_id)]
[url_helpers.namespace_project_path(namespace, project),
url_helpers.namespace_project_tree_path(namespace, project, submodule_item_id)]
elsif relative_self_url?(url)
relative_self_links(url, submodule_item_id, repository.project)
elsif github_dot_com_url?(url)
......@@ -99,8 +99,8 @@ module SubmoduleHelper
begin
[
namespace_project_path(target_namespace_path, submodule_base),
namespace_project_tree_path(target_namespace_path, submodule_base, commit)
url_helpers.namespace_project_path(target_namespace_path, submodule_base),
url_helpers.namespace_project_tree_path(target_namespace_path, submodule_base, commit)
]
rescue ActionController::UrlGenerationError
[nil, nil]
......@@ -118,4 +118,8 @@ module SubmoduleHelper
rescue URI::InvalidURIError
nil
end
def url_helpers
Gitlab::Routing.url_helpers
end
end
---
title: Fix bug that caused diffs not to show on MRs with changes to submodules
merge_request:
author:
type: fixed
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment