Class: Thredded::EmailNotifier

Inherits:
Object
  • Object
show all
Defined in:
app/notifiers/thredded/email_notifier.rb

Instance Method Summary collapse

Constructor Details

#initializeEmailNotifier

Returns a new instance of EmailNotifier.



5
6
7
# File 'app/notifiers/thredded/email_notifier.rb', line 5

def initialize
  fail 'Please set Thredded.email_from in config/initializers/thredded.rb' if Thredded.email_from.blank?
end

Instance Method Details

#human_nameObject



9
10
11
# File 'app/notifiers/thredded/email_notifier.rb', line 9

def human_name
  I18n.t('thredded.email_notifier.by_email')
end

#keyObject



13
14
15
# File 'app/notifiers/thredded/email_notifier.rb', line 13

def key
  'email'
end

#new_post(post, users) ⇒ Object



17
18
19
# File 'app/notifiers/thredded/email_notifier.rb', line 17

def new_post(post, users)
  Thredded::PostMailer.post_notification(post.id, users.map(&:email)).deliver_now
end

#new_private_post(post, users) ⇒ Object



21
22
23
# File 'app/notifiers/thredded/email_notifier.rb', line 21

def new_private_post(post, users)
  Thredded::PrivateTopicMailer.message_notification(post.id, users.map(&:email)).deliver_now
end