Class: Course::Assessment::Answer::CommentNotifier

Inherits:
Notifier::Base
  • Object
show all
Defined in:
app/notifiers/course/assessment/answer/comment_notifier.rb

Instance Method Summary collapse

Instance Method Details

#annotation_replied(user, post) ⇒ Object

To be called when user adds a post to a programming annotation.


4
5
6
7
8
9
10
11
12
# File 'app/notifiers/course/assessment/answer/comment_notifier.rb', line 4

def annotation_replied(user, post)
  return unless email_enabled?(post)

  activity = create_activity(actor: user, object: post, event: :annotated)
  post.topic.subscriptions.includes(:user).each do |subscription|
    activity.notify(subscription.user, :email) unless subscription.user == user
  end
  activity.save!
end