diff --git a/app/helpers/comments_helper.rb b/app/helpers/comments_helper.rb index 314518e0b..36952af7d 100644 --- a/app/helpers/comments_helper.rb +++ b/app/helpers/comments_helper.rb @@ -12,7 +12,7 @@ module CommentsHelper parent_id.blank? ? dom_id(commentable) : "comment_#{parent_id}" end - def children_of_in(parent, comments) + def select_children(comments, parent) return [] if comments.blank? comments.select{|c| c.parent_id == parent.id} end diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index 37a80d830..3ee61e9f4 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -2,7 +2,7 @@
<% if comment.hidden? || comment.user.hidden? %> - <% if children_of_in(comment, @comments).size > 0 %> + <% if select_children(@comments, comment).size > 0 %>

<%= t("debates.comment.deleted") %>

@@ -79,7 +79,7 @@
- <%= t("debates.comment.responses", count: children_of_in(comment, @comments).size) %> + <%= t("debates.comment.responses", count: select_children(@comments, comment).size) %> <% if user_signed_in? %>  |  @@ -95,7 +95,7 @@ <% end %>
- <%= render children_of_in(comment, @comments) if @comments.present? %> + <%= render select_children(@comments, comment) if @comments.present? %>