6157d8b4bd
If you're added as an assignee, or if you comment, then your watching preference will be toggled on.
21 lines
397 B
Ruby
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
|