app/cells/decidim/comments/comment_cell.rb in decidim-comments-0.26.0.rc2 vs app/cells/decidim/comments/comment_cell.rb in decidim-comments-0.26.0
- old
+ new
@@ -32,11 +32,11 @@
render :votes
end
def perform_caching?
- super && has_replies? == false
+ super && has_replies_in_children? == false
end
private
def cache_hash
@@ -179,11 +179,19 @@
def nested_level_even?
depth.even?
end
+ def commentable?
+ has_replies? && !model.deleted? && !model.hidden?
+ end
+
def has_replies?
- model.comment_threads.any?
+ model.comment_threads.includes(:moderation).collect { |c| !c.deleted? && !c.hidden? }.any?
+ end
+
+ def has_replies_in_children?
+ has_replies? || model.comment_threads.includes(:moderation).collect { |t| t.comment_threads.includes(:moderation).collect { |c| !c.deleted? && !c.hidden? }.any? }.any?
end
# action_authorization_button expects current_component to be available
def current_component
root_commentable.try(:component)