Sha256: 267fd29acef5051192089cdd627def94e0e7a4ee24967c6016250992f6e7a0b6

Contents?: true

Size: 485 Bytes

Versions: 2

Compression:

Stored size: 485 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}
      pp recipients
      SubscriptionsMailer.comment_created(comment, recipients).deliver \
        unless recipients.empty?
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
commontator-1.1.1 app/models/commontator/comment_observer.rb~
commontator-1.1.0 app/models/commontator/comment_observer.rb~