Commit 26ac53b3 authored by Douwe Maan's avatar Douwe Maan

Ensure SubmoduleHelper works outside view context

parent 65b16f98
Pipeline #72242179 passed with stages
in 68 minutes and 41 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