feat(i18n): send dossier notifications with its user locale
This commit is contained in:
parent
34b1418868
commit
cd9f7df502
1 changed files with 10 additions and 6 deletions
|
@ -22,8 +22,10 @@ class NotificationMailer < ApplicationMailer
|
||||||
@logo_url = attach_logo(@dossier.procedure)
|
@logo_url = attach_logo(@dossier.procedure)
|
||||||
@rendered_template = sanitize(@body)
|
@rendered_template = sanitize(@body)
|
||||||
|
|
||||||
|
I18n.with_locale(@dossier.user_locale) do
|
||||||
mail(subject: @subject, to: @email, template_name: 'send_notification')
|
mail(subject: @subject, to: @email, template_name: 'send_notification')
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def self.send_en_construction_notification(dossier)
|
def self.send_en_construction_notification(dossier)
|
||||||
with(dossier: dossier, state: Dossier.states.fetch(:en_construction)).send_notification
|
with(dossier: dossier, state: Dossier.states.fetch(:en_construction)).send_notification
|
||||||
|
@ -53,6 +55,7 @@ class NotificationMailer < ApplicationMailer
|
||||||
if @dossier.user_deleted?
|
if @dossier.user_deleted?
|
||||||
mail.perform_deliveries = false
|
mail.perform_deliveries = false
|
||||||
else
|
else
|
||||||
|
I18n.with_locale(@dossier.user_locale) do
|
||||||
mail_template = @dossier.procedure.mail_template_for(params[:state])
|
mail_template = @dossier.procedure.mail_template_for(params[:state])
|
||||||
|
|
||||||
@email = @dossier.user_email_for(:notification)
|
@email = @dossier.user_email_for(:notification)
|
||||||
|
@ -61,6 +64,7 @@ class NotificationMailer < ApplicationMailer
|
||||||
@actions = mail_template.actions_for_dossier(@dossier)
|
@actions = mail_template.actions_for_dossier(@dossier)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def create_commentaire_for_notification
|
def create_commentaire_for_notification
|
||||||
body = ["[#{@subject}]", @body].join("<br><br>")
|
body = ["[#{@subject}]", @body].join("<br><br>")
|
||||||
|
|
Loading…
Reference in a new issue