2014-08-06 14:47:47 +02:00
|
|
|
# Sending mails related to events' notes
|
2015-07-25 18:32:27 +02:00
|
|
|
class NoteMailer < ApplicationMailer
|
2014-08-16 17:39:24 +02:00
|
|
|
helper :events
|
|
|
|
|
2014-07-21 01:26:58 +02:00
|
|
|
def notify(note)
|
2014-06-23 23:39:42 +02:00
|
|
|
@note = note
|
|
|
|
|
2015-04-18 17:24:15 +02:00
|
|
|
host = ActionMailer::Base.default_url_options[:host]
|
2014-08-06 14:47:47 +02:00
|
|
|
mail 'In-Reply-To' =>
|
2015-04-18 17:24:15 +02:00
|
|
|
"<event-#{note.event.id}@#{host}>",
|
2014-08-06 14:47:47 +02:00
|
|
|
to: note.event.submitter,
|
2019-12-22 11:58:20 +01:00
|
|
|
subject: subject(note.event),
|
|
|
|
'Content-Language': locale
|
2014-07-21 01:26:58 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def create(note)
|
|
|
|
@note = note
|
|
|
|
|
2014-08-06 14:47:47 +02:00
|
|
|
mail 'In-Reply-To' =>
|
|
|
|
"<mod-#{note.event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
2019-12-22 11:58:20 +01:00
|
|
|
subject: subject(note.event),
|
|
|
|
'Content-Language': locale
|
2016-11-07 22:30:44 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def subject(event)
|
|
|
|
t('mail_prefix') +
|
|
|
|
t("#{mailer_name}.#{action_name}.subject", subject: event.title)
|
2014-06-23 23:39:42 +02:00
|
|
|
end
|
|
|
|
end
|