agenda-libre-ruby/app/mailers/moderation_mailer.rb

47 lines
1.1 KiB
Ruby
Raw Normal View History

# Sending mails related to events' moderation
class ModerationMailer < ApplicationMailer
helper :events
2014-06-09 12:18:40 +02:00
def create(event)
@event = event
mail 'Message-ID' =>
"<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
subject: subject(event)
2014-06-09 12:18:40 +02:00
end
def update(event)
2014-06-09 12:18:40 +02:00
@event = event
@current_user = User.find_by id: event.paper_trail.originator
2014-06-09 12:18:40 +02:00
mail 'In-Reply-To' =>
"<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
subject: subject(event)
2014-06-09 12:18:40 +02:00
end
def accept(event)
2014-06-09 12:18:40 +02:00
@event = event
@current_user = User.find_by id: event.paper_trail.originator
2014-06-09 12:18:40 +02:00
mail 'In-Reply-To' =>
"<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
subject: subject(event)
2014-07-01 15:50:39 +02:00
end
def destroy(event)
2014-07-01 15:50:39 +02:00
@event = event
@current_user = User.find_by id: event.paper_trail.originator
2014-07-01 15:50:39 +02:00
mail 'In-Reply-To' =>
"<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
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