38 lines
1.1 KiB
Ruby
38 lines
1.1 KiB
Ruby
# Sending mails related to events life cycle
|
|
class EventMailer < ActionMailer::Base
|
|
helper :events
|
|
|
|
def create(event)
|
|
@event = event
|
|
|
|
mail 'Message-ID' =>
|
|
"<event-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
|
to: event.submitter,
|
|
subject: t('mail_suffix') +
|
|
t('event_mailer.create.subject', subject: event.title)
|
|
end
|
|
|
|
def accept(event, current_user)
|
|
@event = event
|
|
@current_user = current_user
|
|
|
|
mail 'In-Reply-To' =>
|
|
"<event-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
|
to: event.submitter,
|
|
subject: t('mail_suffix') +
|
|
t('event_mailer.accept.subject', subject: event.title)
|
|
end
|
|
|
|
def destroy(event, current_user, reason)
|
|
@event = event
|
|
@current_user = current_user
|
|
@reason = reason
|
|
|
|
mail 'In-Reply-To' =>
|
|
"<event-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
|
to: event.submitter,
|
|
subject: t('mail_suffix') +
|
|
t('event_mailer.destroy.subject', subject: event.title)
|
|
end
|
|
end
|