2014-08-06 14:47:47 +02:00
|
|
|
# Sending mails related to events' moderation
|
2015-07-25 18:32:27 +02:00
|
|
|
class ModerationMailer < ApplicationMailer
|
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]}>",
|
2016-11-07 22:30:44 +01:00
|
|
|
subject: subject(event)
|
2014-06-09 12:18:40 +02:00
|
|
|
end
|
|
|
|
|
2015-10-22 21:14:36 +02:00
|
|
|
def update(event)
|
2014-06-09 12:18:40 +02:00
|
|
|
@event = event
|
2016-07-02 16:48:47 +02:00
|
|
|
@current_user = User.find_by id: event.paper_trail.originator
|
2014-06-09 12:18:40 +02:00
|
|
|
|
2014-08-06 14:47:47 +02:00
|
|
|
mail 'In-Reply-To' =>
|
|
|
|
"<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
2016-11-07 22:30:44 +01:00
|
|
|
subject: subject(event)
|
2014-06-09 12:18:40 +02:00
|
|
|
end
|
|
|
|
|
2015-10-22 21:14:36 +02:00
|
|
|
def accept(event)
|
2014-06-09 12:18:40 +02:00
|
|
|
@event = event
|
2016-07-02 16:48:47 +02:00
|
|
|
@current_user = User.find_by id: event.paper_trail.originator
|
2014-06-09 12:18:40 +02:00
|
|
|
|
2014-08-06 14:47:47 +02:00
|
|
|
mail 'In-Reply-To' =>
|
|
|
|
"<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
2016-11-07 22:30:44 +01:00
|
|
|
subject: subject(event)
|
2014-07-01 15:50:39 +02:00
|
|
|
end
|
|
|
|
|
2015-10-22 21:14:36 +02:00
|
|
|
def destroy(event)
|
2014-07-01 15:50:39 +02:00
|
|
|
@event = event
|
2016-07-02 16:48:47 +02:00
|
|
|
@current_user = User.find_by id: event.paper_trail.originator
|
2014-07-01 15:50:39 +02:00
|
|
|
|
2014-08-06 14:47:47 +02:00
|
|
|
mail 'In-Reply-To' =>
|
|
|
|
"<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
2016-11-07 22:30:44 +01:00
|
|
|
subject: subject(event)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def subject(event)
|
|
|
|
t('mail_prefix') +
|
|
|
|
t("#{mailer_name}.#{action_name}.subject", subject: event.title)
|
2014-06-09 12:18:40 +02:00
|
|
|
end
|
|
|
|
end
|