Class: Effective::MessagingMailer

Inherits:
Object
  • Object
show all
Includes:
EffectiveEmailTemplatesMailer, EffectiveMailer
Defined in:
app/mailers/effective/messaging_mailer.rb

Instance Method Summary collapse

Instance Method Details

#chat_new_message(chat, chat_user, opts = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'app/mailers/effective/messaging_mailer.rb', line 6

def chat_new_message(chat, chat_user, opts = {})
  raise('expected a chat') unless chat.kind_of?(Chat)
  raise('expected a chat user') unless chat_user.kind_of?(ChatUser)

  user = chat_user.user
  raise('expected user to have an email') unless user.try(:email).present?

  @assigns = chat_assigns(chat, user: user).merge(assigns_for(chat_user))
  mail(to: user.email, **headers_for(chat, opts))
end