diff options
author | gfyoung <gfyoung17@gmail.com> | 2018-08-18 04:19:57 -0700 |
---|---|---|
committer | gfyoung <gfyoung17@gmail.com> | 2018-09-06 17:33:46 -0700 |
commit | 1993a4449a5be44acfa5a9e1a94842e05da5edd5 (patch) | |
tree | 80a38bd0b427a5baf7ca36a3a71f8eb75c9d912f /app/helpers/tree_helper.rb | |
parent | 07d5ee361a438fcfff28fe184bbec2aa98ce5d14 (diff) | |
download | gitlab-ce-1993a4449a5be44acfa5a9e1a94842e05da5edd5.tar.gz |
Enable frozen string for app/helpers/**/*.rb
Partially addresses #47424.
Diffstat (limited to 'app/helpers/tree_helper.rb')
-rw-r--r-- | app/helpers/tree_helper.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb index dc42caa70e5..80f61a371fd 100644 --- a/app/helpers/tree_helper.rb +++ b/app/helpers/tree_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module TreeHelper FILE_LIMIT = 1_000 @@ -8,7 +10,7 @@ module TreeHelper def render_tree(tree) # Sort submodules and folders together by name ahead of files folders, files, submodules = tree.trees, tree.blobs, tree.submodules - tree = '' + tree = [] items = (folders + submodules).sort_by(&:name) + files if items.size > FILE_LIMIT @@ -18,7 +20,7 @@ module TreeHelper end tree << render(partial: 'projects/tree/tree_row', collection: items) if items.present? - tree.html_safe + tree.join.html_safe end # Return an image icon depending on the file type and mode |