app/models/concerns/comment_states.rb in the_comments-2.2.1 vs app/models/concerns/comment_states.rb in the_comments-2.2.2
- old
+ new
@@ -45,11 +45,17 @@
end
end
# to deleted (cascade like query)
after_transition [:draft, :published] => :deleted do |comment|
- ids = comment.self_and_descendants.map(&:id)
- ::Comment.where(id: ids).update_all(state: :deleted)
+
+ if TheComments.config.delete_descendants_on_node_delete
+ ids = comment.self_and_descendants.map(&:id)
+ ::Comment.where(id: ids).update_all(state: :deleted)
+ else
+ id = comment.id
+ ::Comment.where(id: id).update_all(state: :deleted)
+ end
@owner.try :recalculate_my_comments_counter!
@holder.try :recalculate_comcoms_counters!
@commentable.try :recalculate_comments_counters!
end
\ No newline at end of file