diff options
author | Nick Thomas <nick@gitlab.com> | 2019-07-22 13:58:26 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-07-22 13:58:26 +0000 |
commit | 8b284a51c03d6ab0634f115b38014d5a87f73d57 (patch) | |
tree | 4b46871a250d609b56d75ed7c312b9e88c51b3ac /app | |
parent | b40630e134c09e02322d9b17ddf45667d2fa6573 (diff) | |
parent | 26ac53b3536b641a8875b9b41047e8154ed58f1c (diff) | |
download | gitlab-ce-8b284a51c03d6ab0634f115b38014d5a87f73d57.tar.gz |
Merge branch 'dm-submodule-helper-routing' into 'master'
Ensure SubmoduleHelper works outside view context
Closes #64833
See merge request gitlab-org/gitlab-ce!31005
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/submodule_helper.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/app/helpers/submodule_helper.rb b/app/helpers/submodule_helper.rb index 35e04b0ced3..9a281065b90 100644 --- a/app/helpers/submodule_helper.rb +++ b/app/helpers/submodule_helper.rb @@ -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 |