Class: Course::AnnouncementNotifier

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

Instance Method Summary collapse

Instance Method Details

#new_announcement(user, announcement) ⇒ Object

To be called when an announcement is made.


4
5
6
7
8
9
10
11
# File 'app/notifiers/course/announcement_notifier.rb', line 4

def new_announcement(user, announcement)
  email_enabled = Course::Settings::AnnouncementsComponent.
                  email_enabled?(announcement.course, :new_announcement)

  create_activity(actor: user, object: announcement, event: :new).
    notify(announcement.course, :email).
    save if email_enabled
end