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

Ensure SubmoduleHelper works outside view context

parent 65b16f98
...@@ -34,8 +34,8 @@ module SubmoduleHelper ...@@ -34,8 +34,8 @@ module SubmoduleHelper
project.sub!(/\.git\z/, '') project.sub!(/\.git\z/, '')
if self_url?(url, namespace, project) if self_url?(url, namespace, project)
[namespace_project_path(namespace, project), [url_helpers.namespace_project_path(namespace, project),
namespace_project_tree_path(namespace, project, submodule_item_id)] url_helpers.namespace_project_tree_path(namespace, project, submodule_item_id)]
elsif relative_self_url?(url) elsif relative_self_url?(url)
relative_self_links(url, submodule_item_id, repository.project) relative_self_links(url, submodule_item_id, repository.project)
elsif github_dot_com_url?(url) elsif github_dot_com_url?(url)
...@@ -99,8 +99,8 @@ module SubmoduleHelper ...@@ -99,8 +99,8 @@ module SubmoduleHelper
begin begin
[ [
namespace_project_path(target_namespace_path, submodule_base), url_helpers.namespace_project_path(target_namespace_path, submodule_base),
namespace_project_tree_path(target_namespace_path, submodule_base, commit) url_helpers.namespace_project_tree_path(target_namespace_path, submodule_base, commit)
] ]
rescue ActionController::UrlGenerationError rescue ActionController::UrlGenerationError
[nil, nil] [nil, nil]
...@@ -118,4 +118,8 @@ module SubmoduleHelper ...@@ -118,4 +118,8 @@ module SubmoduleHelper
rescue URI::InvalidURIError rescue URI::InvalidURIError
nil nil
end end
def url_helpers
Gitlab::Routing.url_helpers
end
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