Sha256: b4ab1d8ac425ecdd37ec8d3f9909782ee57496129adfb524fdc3ffa61065d69c

Contents?: true

Size: 465 Bytes

Versions: 7

Compression:

Stored size: 465 Bytes

Contents

module Commontator
  class CommentObserver < ActiveRecord::Observer
    def after_create(comment)
      thread = comment.thread
      thread.subscribe(comment.creator) if thread.config.auto_subscribe_on_comment
      thread.add_unread_except_for(comment.creator)
      recipients = thread.active_subscribers.reject{|s| s == comment.creator}
      SubscriptionsMailer.comment_created(comment, recipients).deliver \
        unless recipients.empty?
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
commontator-2.0.2 app/models/commontator/comment_observer.rb
commontator-2.0.1 app/models/commontator/comment_observer.rb
commontator-2.0.0 app/models/commontator/comment_observer.rb
commontator-1.1.3 app/models/commontator/comment_observer.rb
commontator-1.1.2 app/models/commontator/comment_observer.rb
commontator-1.1.1 app/models/commontator/comment_observer.rb
commontator-1.1.0 app/models/commontator/comment_observer.rb