2016-10-28 19:14:24 +02:00
|
|
|
# Send mails to check on organisations life cycle
|
|
|
|
class ModerationorgaMailer < ApplicationMailer
|
|
|
|
helper :events
|
|
|
|
|
|
|
|
def create(orga)
|
|
|
|
@orga = orga
|
|
|
|
|
|
|
|
mail 'Message-ID' =>
|
|
|
|
"<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
2019-12-22 11:58:20 +01:00
|
|
|
subject: subject(orga),
|
|
|
|
'Content-Language': locale
|
2016-10-28 19:14:24 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def update(orga)
|
|
|
|
@orga = orga
|
|
|
|
@current_user = User.find_by id: orga.paper_trail.originator
|
|
|
|
|
|
|
|
mail 'In-Reply-To' =>
|
|
|
|
"<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
2019-12-22 11:58:20 +01:00
|
|
|
subject: subject(orga),
|
|
|
|
'Content-Language': locale
|
2016-10-28 19:14:24 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept(orga)
|
|
|
|
@orga = orga
|
|
|
|
@current_user = User.find_by id: orga.paper_trail.originator
|
|
|
|
|
|
|
|
mail 'In-Reply-To' =>
|
|
|
|
"<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
2019-12-22 11:58:20 +01:00
|
|
|
subject: subject(orga),
|
|
|
|
'Content-Language': locale
|
2016-10-28 19:14:24 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def destroy(orga, reason = '')
|
|
|
|
@orga = orga
|
|
|
|
@current_user = User.find_by id: orga.paper_trail.originator
|
|
|
|
@reason = reason
|
|
|
|
|
|
|
|
mail 'In-Reply-To' =>
|
|
|
|
"<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
2019-12-22 11:58:20 +01:00
|
|
|
subject: subject(orga),
|
|
|
|
'Content-Language': locale
|
2016-11-07 22:30:44 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def subject(orga)
|
|
|
|
t('mail_prefix') +
|
|
|
|
t("#{mailer_name}.#{action_name}.subject", subject: orga.name)
|
2016-10-28 19:14:24 +02:00
|
|
|
end
|
|
|
|
end
|