From 22e9af3c8b8aedf7f46b786be968862b74a2d07e Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 27 Jan 2020 12:08:35 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- app/helpers/submodule_helper.rb | 13 +++++++++---- app/helpers/tree_helper.rb | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'app/helpers') diff --git a/app/helpers/submodule_helper.rb b/app/helpers/submodule_helper.rb index 9707a5cef3b..32c613ab4ad 100644 --- a/app/helpers/submodule_helper.rb +++ b/app/helpers/submodule_helper.rb @@ -39,9 +39,9 @@ module SubmoduleHelper elsif relative_self_url?(url) relative_self_links(url, submodule_item_id, repository.project) elsif github_dot_com_url?(url) - standard_links('github.com', namespace, project, submodule_item_id) + github_com_tree_links(namespace, project, submodule_item_id) elsif gitlab_dot_com_url?(url) - standard_links('gitlab.com', namespace, project, submodule_item_id) + gitlab_com_tree_links(namespace, project, submodule_item_id) else [sanitize_submodule_url(url), nil] end @@ -73,8 +73,13 @@ module SubmoduleHelper url.start_with?('../', './') end - def standard_links(host, namespace, project, commit) - base = ['https://', host, '/', namespace, '/', project].join('') + def gitlab_com_tree_links(namespace, project, commit) + base = ['https://gitlab.com/', namespace, '/', project].join('') + [base, [base, '/-/tree/', commit].join('')] + end + + def github_com_tree_links(namespace, project, commit) + base = ['https://github.com/', namespace, '/', project].join('') [base, [base, '/tree/', commit].join('')] end diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb index af1919eeb40..0b50b8b1130 100644 --- a/app/helpers/tree_helper.rb +++ b/app/helpers/tree_helper.rb @@ -38,13 +38,13 @@ module TreeHelper # many paths, as with a repository tree that has thousands of items. def fast_project_blob_path(project, blob_path) ActionDispatch::Journey::Router::Utils.escape_path( - File.join(relative_url_root, project.path_with_namespace, 'blob', blob_path) + File.join(relative_url_root, project.path_with_namespace, '-', 'blob', blob_path) ) end def fast_project_tree_path(project, tree_path) ActionDispatch::Journey::Router::Utils.escape_path( - File.join(relative_url_root, project.path_with_namespace, 'tree', tree_path) + File.join(relative_url_root, project.path_with_namespace, '-', 'tree', tree_path) ) end -- cgit v1.2.1