diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /app/helpers/tree_helper.rb | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) | |
download | gitlab-ce-859a6fb938bb9ee2a317c46dfa4fcc1af49608f0.tar.gz |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'app/helpers/tree_helper.rb')
-rw-r--r-- | app/helpers/tree_helper.rb | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb index f24aa5d3bcb..b050f533d77 100644 --- a/app/helpers/tree_helper.rb +++ b/app/helpers/tree_helper.rb @@ -4,30 +4,6 @@ module TreeHelper include BlobHelper include WebIdeButtonHelper - FILE_LIMIT = 1_000 - - # Sorts a repository's tree so that folders are before files and renders - # their corresponding partials - # - # tree - A `Tree` object for the current tree - # rubocop: disable CodeReuse/ActiveRecord - def render_tree(tree) - # Sort submodules and folders together by name ahead of files - folders, files, submodules = tree.trees, tree.blobs, tree.submodules - tree = [] - items = (folders + submodules).sort_by(&:name) + files - - if items.size > FILE_LIMIT - tree << render(partial: 'projects/tree/truncated_notice_tree_row', - locals: { limit: FILE_LIMIT, total: items.size }) - items = items.take(FILE_LIMIT) - end - - tree << render(partial: 'projects/tree/tree_row', collection: items) if items.present? - tree.join.html_safe - end - # rubocop: enable CodeReuse/ActiveRecord - # Return an image icon depending on the file type and mode # # type - String type of the tree item; either 'folder' or 'file' @@ -37,20 +13,6 @@ module TreeHelper sprite_icon(file_type_icon_class(type, mode, name)) end - # Using Rails `*_path` methods can be slow, especially when generating - # 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) - ) - 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) - ) - end - # Simple shortcut to File.join def tree_join(*args) File.join(*args) @@ -167,13 +129,6 @@ module TreeHelper Gitlab.config.gitlab.relative_url_root.presence || '/' end - # project and path are used on the EE version - def tree_content_data(logs_path, project, path) - { - "logs-path" => logs_path - } - end - def breadcrumb_data_attributes attrs = { can_collaborate: can_collaborate_with_project?(@project).to_s, |