Files
fizzy/app/models/bubble/commentable.rb
T
Kevin McConnell 6157d8b4bd Start watching when participating on a bubble
If you're added as an assignee, or if you comment, then your watching
preference will be toggled on.
2025-02-26 10:53:03 +00:00

21 lines
397 B
Ruby

module Bubble::Commentable
extend ActiveSupport::Concern
included do
scope :ordered_by_comments, -> { order comments_count: :desc }
end
def comment_created(comment)
increment! :comments_count
set_watching comment.creator, true
track_event :commented, comment_id: comment.id
rescore
end
def comment_destroyed
decrement! :comments_count
rescore
end
end