Remove vars_mailer and simplify code
This commit is contained in:
parent
2e0abb054c
commit
32a2ab153f
1 changed files with 4 additions and 10 deletions
|
@ -1,6 +1,4 @@
|
|||
class NotificationMailer < ApplicationMailer
|
||||
default to: Proc.new { @user.email }
|
||||
|
||||
def new_answer(dossier)
|
||||
subject = "Nouveau message pour votre dossier demarches-simplifiees.fr nº #{dossier.id}"
|
||||
|
||||
|
@ -35,26 +33,22 @@ class NotificationMailer < ApplicationMailer
|
|||
|
||||
private
|
||||
|
||||
def vars_mailer(dossier)
|
||||
@user = dossier.user
|
||||
end
|
||||
|
||||
def send_mail(dossier, subject)
|
||||
vars_mailer(dossier)
|
||||
@dossier = dossier
|
||||
email = dossier.user.email
|
||||
|
||||
mail(subject: subject)
|
||||
mail(subject: subject, to: email)
|
||||
end
|
||||
|
||||
def send_notification(dossier, mail_template)
|
||||
vars_mailer(dossier)
|
||||
email = dossier.user.email
|
||||
|
||||
subject = mail_template.subject_for_dossier(dossier)
|
||||
body = mail_template.body_for_dossier(dossier)
|
||||
|
||||
create_commentaire_for_notification(dossier, subject, body)
|
||||
|
||||
mail(subject: subject) { |format| format.html { body } }
|
||||
mail(subject: subject, to: email) { |format| format.html { body } }
|
||||
end
|
||||
|
||||
def create_commentaire_for_notification(dossier, subject, body)
|
||||
|
|
Loading…
Reference in a new issue