2014-08-06 14:47:47 +02:00
|
|
|
# Sending mails related to events' moderation
|
2014-06-09 12:18:40 +02:00
|
|
|
class ModerationMailer < ActionMailer::Base
|
2014-08-16 17:39:24 +02:00
|
|
|
helper :events
|
|
|
|
|
2014-06-09 12:18:40 +02:00
|
|
|
def create(event)
|
|
|
|
@event = event
|
|
|
|
|
2014-08-06 14:47:47 +02:00
|
|
|
mail 'Message-ID' =>
|
|
|
|
"<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
2014-08-17 22:43:54 +02:00
|
|
|
subject: t('mail_suffix') +
|
|
|
|
t('moderation_mailer.create.subject', subject: event.title)
|
2014-06-09 12:18:40 +02:00
|
|
|
end
|
|
|
|
|
2014-08-06 14:47:47 +02:00
|
|
|
def update(older_event, event, current_user)
|
|
|
|
@older_event = older_event
|
2014-06-09 12:18:40 +02:00
|
|
|
@event = event
|
|
|
|
@current_user = current_user
|
|
|
|
|
2014-08-06 14:47:47 +02:00
|
|
|
mail 'In-Reply-To' =>
|
|
|
|
"<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
2014-08-17 22:43:54 +02:00
|
|
|
subject: t('mail_suffix') +
|
|
|
|
t('moderation_mailer.update.subject', subject: event.title)
|
2014-06-09 12:18:40 +02:00
|
|
|
end
|
|
|
|
|
2014-07-01 15:50:39 +02:00
|
|
|
def accept(event, current_user)
|
2014-06-09 12:18:40 +02:00
|
|
|
@event = event
|
|
|
|
@current_user = current_user
|
|
|
|
|
2014-08-06 14:47:47 +02:00
|
|
|
mail 'In-Reply-To' =>
|
|
|
|
"<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
2014-08-17 22:43:54 +02:00
|
|
|
subject: t('mail_suffix') +
|
|
|
|
t('moderation_mailer.accept.subject', subject: event.title)
|
2014-07-01 15:50:39 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def destroy(event, current_user, reason)
|
|
|
|
@event = event
|
|
|
|
@current_user = current_user
|
|
|
|
@reason = reason
|
|
|
|
|
2014-08-06 14:47:47 +02:00
|
|
|
mail 'In-Reply-To' =>
|
|
|
|
"<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
2014-08-17 22:43:54 +02:00
|
|
|
subject: t('mail_suffix') +
|
|
|
|
t('moderation_mailer.destroy.subject', subject: event.title)
|
2014-06-09 12:18:40 +02:00
|
|
|
end
|
|
|
|
end
|