diff --git a/app/views/articles/_comment_tree.html.erb b/app/views/articles/_comment_tree.html.erb new file mode 100644 index 000000000..e46f155c7 --- /dev/null +++ b/app/views/articles/_comment_tree.html.erb @@ -0,0 +1,2 @@ +<% comment, sub_comments = comment_node %> +<%= nested_comments(tree: { comment => sub_comments }, commentable: @article, is_view_root: true) %> diff --git a/app/views/articles/_full_comment_area.html.erb b/app/views/articles/_full_comment_area.html.erb index 4c2cb6149..80c38b133 100644 --- a/app/views/articles/_full_comment_area.html.erb +++ b/app/views/articles/_full_comment_area.html.erb @@ -28,11 +28,7 @@
<% if @article.comments_count > 0 %> - <% Comment.tree_for(@article, @comments_to_show_count).each do |comment, sub_comments| %> - <% cache ["comment_root_cached_tree", comment] do %> - <%= tree_for(comment, sub_comments, @article) %> - <% end %> - <% end %> + <%= render partial: "articles/comment_tree", collection: Comment.tree_for(@article, @comments_to_show_count), as: :comment_node, cached: proc { |comment, _sub_comments| comment } %> <% end %>