Merge pull request #6436 from tchak/feat-save-user-locale

feat(i18n): use locale from user preferences when sending notifications
This commit is contained in:
Paul Chavard 2021-09-07 10:04:57 +02:00 committed by GitHub
commit 1f23295f91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 196 additions and 181 deletions

View file

@ -78,6 +78,9 @@ class ApplicationController < ActionController::Base
def set_locale(locale) def set_locale(locale)
if locale && locale.to_sym.in?(I18n.available_locales) if locale && locale.to_sym.in?(I18n.available_locales)
cookies[:locale] = locale cookies[:locale] = locale
if user_signed_in?
current_user.update(locale: locale)
end
locale locale
end end
end end
@ -322,6 +325,7 @@ class ApplicationController < ActionController::Base
def switch_locale(&action) def switch_locale(&action)
locale = extract_locale_from_query_params || locale = extract_locale_from_query_params ||
extract_locale_from_cookie || extract_locale_from_cookie ||
extract_locale_from_user ||
extract_locale_from_accept_language_header || extract_locale_from_accept_language_header ||
I18n.default_locale I18n.default_locale
@ -332,6 +336,10 @@ class ApplicationController < ActionController::Base
set_locale(request.query_parameters[:locale]) set_locale(request.query_parameters[:locale])
end end
def extract_locale_from_user
current_user&.locale
end
def extract_locale_from_cookie def extract_locale_from_cookie
cookies[:locale] cookies[:locale]
end end

View file

@ -5,61 +5,73 @@ class DossierMailer < ApplicationMailer
helper ProcedureHelper helper ProcedureHelper
layout 'mailers/layout' layout 'mailers/layout'
default from: NO_REPLY_EMAIL
def notify_new_draft(dossier) def notify_new_draft(dossier)
@dossier = dossier I18n.with_locale(dossier.user_locale) do
@service = dossier.procedure.service @dossier = dossier
@logo_url = attach_logo(dossier.procedure) @service = dossier.procedure.service
@logo_url = attach_logo(dossier.procedure)
@subject = default_i18n_subject(libelle_demarche: dossier.procedure.libelle)
subject = "Retrouvez votre brouillon pour la démarche « #{dossier.procedure.libelle} »" mail(to: dossier.user_email_for(:notification), subject: @subject) do |format|
format.html { render layout: 'mailers/notifications_layout' }
mail(from: NO_REPLY_EMAIL, to: dossier.user_email_for(:notification), subject: subject) do |format| end
format.html { render layout: 'mailers/notifications_layout' }
end end
end end
def notify_new_answer(dossier, body = nil) def notify_new_answer(dossier, body = nil)
@dossier = dossier I18n.with_locale(dossier.user_locale) do
@service = dossier.procedure.service @dossier = dossier
@logo_url = attach_logo(dossier.procedure) @service = dossier.procedure.service
@body = body @logo_url = attach_logo(dossier.procedure)
@body = body
@subject = default_i18n_subject(dossier_id: dossier.id, libelle_demarche: dossier.procedure.libelle)
subject = "Nouveau message pour votre dossier nº #{dossier.id} (#{dossier.procedure.libelle})" mail(to: dossier.user_email_for(:notification), subject: @subject) do |format|
format.html { render layout: 'mailers/notifications_layout' }
mail(from: NO_REPLY_EMAIL, to: dossier.user_email_for(:notification), subject: subject) do |format| end
format.html { render layout: 'mailers/notifications_layout' }
end end
end end
def notify_new_commentaire_to_instructeur(dossier, instructeur_email) def notify_new_commentaire_to_instructeur(dossier, instructeur_email)
@dossier = dossier I18n.with_locale(dossier.user_locale) do
@subject = default_i18n_subject(dossier_id: dossier.id, libelle_demarche: dossier.procedure.libelle) @dossier = dossier
mail(from: NO_REPLY_EMAIL, to: instructeur_email, subject: @subject) @subject = default_i18n_subject(dossier_id: dossier.id, libelle_demarche: dossier.procedure.libelle)
mail(to: instructeur_email, subject: @subject)
end
end end
def notify_new_dossier_depose_to_instructeur(dossier, instructeur_email) def notify_new_dossier_depose_to_instructeur(dossier, instructeur_email)
@dossier = dossier I18n.with_locale(dossier.user_locale) do
@subject = default_i18n_subject(dossier_id: dossier.id, libelle_demarche: dossier.procedure.libelle) @dossier = dossier
mail(from: NO_REPLY_EMAIL, to: instructeur_email, subject: @subject) @subject = default_i18n_subject(dossier_id: dossier.id, libelle_demarche: dossier.procedure.libelle)
mail(to: instructeur_email, subject: @subject)
end
end end
def notify_revert_to_instruction(dossier) def notify_revert_to_instruction(dossier)
@dossier = dossier I18n.with_locale(dossier.user_locale) do
@service = dossier.procedure.service @dossier = dossier
@logo_url = attach_logo(dossier.procedure) @service = dossier.procedure.service
@logo_url = attach_logo(dossier.procedure)
@subject = default_i18n_subject(dossier_id: dossier.id, libelle_demarche: dossier.procedure.libelle)
subject = "Votre dossier nº #{@dossier.id} est en train dêtre réexaminé" mail(to: dossier.user_email_for(:notification), subject: @subject) do |format|
format.html { render layout: 'mailers/notifications_layout' }
mail(from: NO_REPLY_EMAIL, to: dossier.user_email_for(:notification), subject: subject) do |format| end
format.html { render layout: 'mailers/notifications_layout' }
end end
end end
def notify_brouillon_near_deletion(dossiers, to_email) def notify_brouillon_near_deletion(dossiers, to_email)
@subject = default_i18n_subject(count: dossiers.count) I18n.with_locale(dossiers.first.user_locale) do
@dossiers = dossiers @subject = default_i18n_subject(count: dossiers.count)
@dossiers = dossiers
mail(to: to_email, subject: @subject) mail(to: to_email, subject: @subject)
end
end end
def notify_brouillon_deletion(dossier_hashes, to_email) def notify_brouillon_deletion(dossier_hashes, to_email)
@ -70,24 +82,21 @@ class DossierMailer < ApplicationMailer
end end
def notify_deletion_to_user(deleted_dossier, to_email) def notify_deletion_to_user(deleted_dossier, to_email)
@subject = default_i18n_subject(dossier_id: deleted_dossier.dossier_id) I18n.with_locale(deleted_dossier.user_locale) do
@deleted_dossier = deleted_dossier @subject = default_i18n_subject(dossier_id: deleted_dossier.dossier_id)
@deleted_dossier = deleted_dossier
mail(to: to_email, subject: @subject) mail(to: to_email, subject: @subject)
end
end end
def notify_instructeur_deletion_to_user(deleted_dossier, to_email) def notify_instructeur_deletion_to_user(deleted_dossier, to_email)
@subject = default_i18n_subject(libelle_demarche: deleted_dossier.procedure.libelle) I18n.with_locale(deleted_dossier.user_locale) do
@deleted_dossier = deleted_dossier @subject = default_i18n_subject(libelle_demarche: deleted_dossier.procedure.libelle)
@deleted_dossier = deleted_dossier
mail(to: to_email, subject: @subject) mail(to: to_email, subject: @subject)
end end
def notify_instructeur(deleted_dossier, to_email)
@subject = default_i18n_subject(dossier_id: deleted_dossier.dossier_id)
@deleted_dossier = deleted_dossier
mail(to: to_email, subject: @subject)
end end
def notify_deletion_to_administration(deleted_dossier, to_email) def notify_deletion_to_administration(deleted_dossier, to_email)
@ -98,11 +107,13 @@ class DossierMailer < ApplicationMailer
end end
def notify_automatic_deletion_to_user(deleted_dossiers, to_email) def notify_automatic_deletion_to_user(deleted_dossiers, to_email)
@state = deleted_dossiers.first.state I18n.with_locale(deleted_dossiers.first.user_locale) do
@subject = default_i18n_subject(count: deleted_dossiers.count) @state = deleted_dossiers.first.state
@deleted_dossiers = deleted_dossiers @subject = default_i18n_subject(count: deleted_dossiers.count)
@deleted_dossiers = deleted_dossiers
mail(to: to_email, subject: @subject) mail(to: to_email, subject: @subject)
end
end end
def notify_automatic_deletion_to_administration(deleted_dossiers, to_email) def notify_automatic_deletion_to_administration(deleted_dossiers, to_email)
@ -113,11 +124,13 @@ class DossierMailer < ApplicationMailer
end end
def notify_near_deletion_to_user(dossiers, to_email) def notify_near_deletion_to_user(dossiers, to_email)
@state = dossiers.first.state I18n.with_locale(dossiers.first.user_locale) do
@subject = default_i18n_subject(count: dossiers.count, state: @state) @state = dossiers.first.state
@dossiers = dossiers @subject = default_i18n_subject(count: dossiers.count, state: @state)
@dossiers = dossiers
mail(to: to_email, subject: @subject) mail(to: to_email, subject: @subject)
end
end end
def notify_near_deletion_to_administration(dossiers, to_email) def notify_near_deletion_to_administration(dossiers, to_email)
@ -129,18 +142,19 @@ class DossierMailer < ApplicationMailer
end end
def notify_groupe_instructeur_changed(instructeur, dossier) def notify_groupe_instructeur_changed(instructeur, dossier)
@subject = "Un dossier a changé de groupe instructeur" @subject = default_i18n_subject(dossier_id: dossier.id)
@dossier_id = dossier.id @dossier = dossier
@demarche = dossier.procedure.libelle
mail(from: NO_REPLY_EMAIL, to: instructeur.email, subject: @subject) mail(to: instructeur.email, subject: @subject)
end end
def notify_brouillon_not_submitted(dossier) def notify_brouillon_not_submitted(dossier)
@subject = "Attention : votre dossier nest pas déposé." I18n.with_locale(dossier.user_locale) do
@dossier = dossier @subject = default_i18n_subject(dossier_id: dossier.id)
@dossier = dossier
mail(to: dossier.user_email_for(:notification), subject: @subject) mail(to: dossier.user_email_for(:notification), subject: @subject)
end
end end
protected protected

View file

@ -22,7 +22,9 @@ class NotificationMailer < ApplicationMailer
@logo_url = attach_logo(@dossier.procedure) @logo_url = attach_logo(@dossier.procedure)
@rendered_template = sanitize(@body) @rendered_template = sanitize(@body)
mail(subject: @subject, to: @email, template_name: 'send_notification') I18n.with_locale(@dossier.user_locale) do
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)
@ -53,12 +55,14 @@ class NotificationMailer < ApplicationMailer
if @dossier.user_deleted? if @dossier.user_deleted?
mail.perform_deliveries = false mail.perform_deliveries = false
else else
mail_template = @dossier.procedure.mail_template_for(params[:state]) I18n.with_locale(@dossier.user_locale) do
mail_template = @dossier.procedure.mail_template_for(params[:state])
@email = @dossier.user_email_for(:notification) @email = @dossier.user_email_for(:notification)
@subject = mail_template.subject_for_dossier(@dossier) @subject = mail_template.subject_for_dossier(@dossier)
@body = mail_template.body_for_dossier(@dossier) @body = mail_template.body_for_dossier(@dossier)
@actions = mail_template.actions_for_dossier(@dossier) @actions = mail_template.actions_for_dossier(@dossier)
end
end end
end end

View file

@ -47,4 +47,8 @@ class DeletedDossier < ApplicationRecord
def procedure_removed? def procedure_removed?
reason == self.class.reasons.fetch(:procedure_removed) reason == self.class.reasons.fetch(:procedure_removed)
end end
def user_locale
User.find_by(id: user_id)&.locale || I18n.default_locale
end
end end

View file

@ -921,6 +921,10 @@ class Dossier < ApplicationRecord
update_column(:api_entreprise_job_exceptions, exceptions) update_column(:api_entreprise_job_exceptions, exceptions)
end end
def user_locale
user&.locale || I18n.default_locale
end
private private
def defaut_groupe_instructeur? def defaut_groupe_instructeur?

View file

@ -13,6 +13,7 @@
# failed_attempts :integer default(0), not null # failed_attempts :integer default(0), not null
# last_sign_in_at :datetime # last_sign_in_at :datetime
# last_sign_in_ip :string # last_sign_in_ip :string
# locale :string
# locked_at :datetime # locked_at :datetime
# loged_in_with_france_connect :string default(NULL) # loged_in_with_france_connect :string default(NULL)
# remember_created_at :datetime # remember_created_at :datetime

View file

@ -3,7 +3,7 @@
%p= t(:hello, scope: [:views, :shared, :greetings]) %p= t(:hello, scope: [:views, :shared, :greetings])
%p %p
= "Vous suiviez jusqu'à maintenant le dossier n°#{@dossier_id} de la démarche #{@demarche}." = "Vous suiviez jusqu'à maintenant le dossier n° #{@dossier.id} de la démarche #{@dossier.procedure.libelle}."
Lusager a modifié le groupe de routage. Son dossier appartient maintenant à un groupe instructeur dont vous ne faites pas partie. Lusager a modifié le groupe de routage. Son dossier appartient maintenant à un groupe instructeur dont vous ne faites pas partie.
%p %p
Suite à cette modification, vous ne suivez plus ce dossier. Suite à cette modification, vous ne suivez plus ce dossier.

View file

@ -1,31 +0,0 @@
- content_for :procedure_logo do
= render 'layouts/mailers/logo', url: @logo_url
%p= t(:hello, scope: [:views, :shared, :greetings])
- if !@dossier.brouillon?
%p
You received
%strong a new message
from the service in charge of examine your File.
%p
To read the message and answer it, select the following link:
= round_button('Read the message', messagerie_dossier_url(@dossier), :primary)
- else
%p
You received
%strong a new message
from the service in charge of examine the File you started a draft for on the procedure #{@dossier.procedure.libelle}.
%p{ style: "padding: 8px; color: #333333; background-color: #EEEEEE; font-size: 14px;" }
= @body
%p
If you chose to contact the service, please use the email available below in the page.
= round_button('Open the File', dossier_url(@dossier), :primary)
= render 'layouts/mailers/signature', service: @service
- content_for :footer do
= render 'layouts/mailers/service_footer', service: @service, dossier: @dossier

View file

@ -4,25 +4,15 @@
%p= t(:hello, scope: [:views, :shared, :greetings]) %p= t(:hello, scope: [:views, :shared, :greetings])
- if !@dossier.brouillon? - if !@dossier.brouillon?
%p %p= t('.body', libelle_demarche: @dossier.procedure.libelle)
Vous avez reçu un %p= t('.link')
%strong nouveau message = round_button(t('.access_message'), messagerie_dossier_url(@dossier), :primary)
de la part du service en charge de votre dossier.
%p
Pour consulter le message et y répondre, cliquez sur le bouton ci-dessous :
= round_button('Lire le message', messagerie_dossier_url(@dossier), :primary)
- else - else
%p %p= t('.body_draft', libelle_demarche: @dossier.procedure.libelle)
Vous avez reçu un
%strong nouveau message
du service pour lequel votre dossier est en brouillon pour la démarche #{@dossier.procedure.libelle}.
%p{ style: "padding: 8px; color: #333333; background-color: #EEEEEE; font-size: 14px;" } %p{ style: "padding: 8px; color: #333333; background-color: #EEEEEE; font-size: 14px;" }
= @body = @body
%p= t('.contact')
%p Si vous souhaitez contacter le service, merci de le faire directement à l'aide de l'email en bas de page. = round_button(t('.access_file'), dossier_url(@dossier), :primary)
= round_button('Voir le dossier', dossier_url(@dossier), :primary)
= render 'layouts/mailers/signature', service: @service = render 'layouts/mailers/signature', service: @service

View file

@ -1,23 +0,0 @@
- content_for :procedure_logo do
= render 'layouts/mailers/logo', url: @logo_url
%p= t(:hello, scope: [:views, :shared, :greetings])
%p
You started filling a File on the procedure:
= succeed '.' do
%strong « #{@dossier.procedure.libelle} »
%p
You can access your File, to review or complete, by clicking on the following button:
= round_button('Access your File', dossier_url(@dossier), :primary)
- if @dossier.procedure.auto_archive_on
%p
Your File needs to be submitted before #{procedure_auto_archive_datetime(@dossier.procedure)}.
= render 'layouts/mailers/signature'
- content_for :footer do
= render 'layouts/mailers/service_footer', service: @service, dossier: @dossier

View file

@ -3,21 +3,12 @@
%p= t(:hello, scope: [:views, :shared, :greetings]) %p= t(:hello, scope: [:views, :shared, :greetings])
%p %p= t('.body', libelle_demarche: @dossier.procedure.libelle)
Vous avez commencé à remplir un dossier pour la démarche %p= t('.link')
= succeed '.' do = round_button(t('.access_file'), dossier_url(@dossier), :primary)
%strong « #{@dossier.procedure.libelle} »
%p
Vous pouvez
%strong retrouver et compléter votre dossier
en cliquant sur le bouton ci-dessous:
= round_button('Afficher votre dossier', dossier_url(@dossier), :primary)
- if @dossier.procedure.auto_archive_on - if @dossier.procedure.auto_archive_on
%p %p= t('.submit_before', before: procedure_auto_archive_datetime(@dossier.procedure))
Vous pouvez déposer votre dossier jusquau #{procedure_auto_archive_datetime(@dossier.procedure)}.
= render 'layouts/mailers/signature' = render 'layouts/mailers/signature'

View file

@ -1,21 +0,0 @@
- content_for :procedure_logo do
= render 'layouts/mailers/logo', url: @logo_url
%p= t(:hello, scope: [:views, :shared, :greetings])
%p
Your File will be reexamined. All previous decisions are void.
To see the File created on procedure
%strong= @dossier.procedure.libelle
, select the following link:
= link_to dossier_url(@dossier), dossier_url(@dossier), target: '_blank', rel: 'noopener'
- if @dossier.procedure.service.present?
%p
In order to get more details about the decision to reexamin, please contact the following service:
= mail_to @dossier.procedure.service.email, @dossier.procedure.service.email
= render 'layouts/mailers/signature'
- content_for :footer do
= render 'layouts/mailers/service_footer', service: @service, dossier: @dossier

View file

@ -4,15 +4,11 @@
%p= t(:hello, scope: [:views, :shared, :greetings]) %p= t(:hello, scope: [:views, :shared, :greetings])
%p %p
Votre dossier va être réexaminé, la précédente décision sur ce dossier est caduque. = t('.body', dossier_id: @dossier.id, libelle_demarche: @dossier.procedure.libelle)
Vous pouvez retrouver le dossier que vous avez créé pour la démarche
%strong= @dossier.procedure.libelle
à l'adresse suivante :
= link_to dossier_url(@dossier), dossier_url(@dossier), target: '_blank', rel: 'noopener' = link_to dossier_url(@dossier), dossier_url(@dossier), target: '_blank', rel: 'noopener'
- if @dossier.procedure.service.present? - if @dossier.procedure.service.present?
%p %p
Pour obtenir le détail de cette modification de la décision, vous pouvez contacter par = t('.contact')
email:
= mail_to @dossier.procedure.service.email, @dossier.procedure.service.email = mail_to @dossier.procedure.service.email, @dossier.procedure.service.email
= render 'layouts/mailers/signature' = render 'layouts/mailers/signature'

View file

@ -0,0 +1,4 @@
fr:
dossier_mailer:
notify_brouillon_not_submitted:
subject: "Attention : votre dossier nº %{dossier_id} nest pas déposé"

View file

@ -0,0 +1,4 @@
fr:
dossier_mailer:
notify_groupe_instructeur_changed:
subject: Le dossier nº %{dossier_id} a changé de groupe instructeur

View file

@ -0,0 +1,13 @@
fr:
dossier_mailer:
notify_new_answer:
subject: New message on your file nº %{dossier_id} « %{libelle_demarche} »
body_html: |
You received <b>a new message</b> from the service in charge of reviewing your file on « %{libelle_demarche} ».
link: |
To read the message and answer it, select the following link:
body_draft_html: |
You received <b>a new message</b> from the service in charge of reviewing the file you started a draft for on the procedure « %{libelle_demarche} ».
contact: If you chose to contact the service, please use the email available below in the page.
access_message: Read the message
access_file: Open file

View file

@ -0,0 +1,13 @@
fr:
dossier_mailer:
notify_new_answer:
subject: Nouveau message pour votre dossier nº %{dossier_id} « %{libelle_demarche} »
body_html: |
Vous avez reçu un <b>nouveau message</b> de la part du service en charge de votre dossier.
link: |
Pour consulter le message et y répondre, cliquez sur le bouton ci-dessous :
body_draft_html: |
Vous avez reçu un <b>nouveau message</b>du service pour lequel votre dossier est en brouillon pour la démarche « %{libelle_demarche} ».
contact: Si vous souhaitez contacter le service, merci de le faire directement à l'aide de l'email en bas de page.
access_message: Lire le message
access_file: Voir le dossier

View file

@ -1,5 +1,5 @@
fr: fr:
dossier_mailer: dossier_mailer:
notify_new_dossier_depose_to_instructeur: notify_new_dossier_depose_to_instructeur:
subject: Nouveau dossier déposé pour la démarche %{libelle_demarche} subject: Nouveau dossier déposé pour la démarche « %{libelle_demarche} »
body: Un nouveau dossier a été déposé (n° %{dossier_id}) pour la démarche %{libelle_demarche} body: Un nouveau dossier a été déposé (n° %{dossier_id}) pour la démarche « %{libelle_demarche} »

View file

@ -0,0 +1,10 @@
en:
dossier_mailer:
notify_new_draft:
subject: Draft file created on procedure « %{libelle_demarche} »
body_html: |
You created a draft file on procedure <b>« %{libelle_demarche} »</b>.
link_html: |
You can access your file, to <b>review or complete</b>, by clicking on the following button:
submit_before: Your file needs to be submitted before %{before}
access_file: Open file

View file

@ -0,0 +1,10 @@
fr:
dossier_mailer:
notify_new_draft:
subject: Retrouvez votre brouillon pour la démarche « %{libelle_demarche} »
body_html: |
Vous avez commencé à remplir un dossier pour la démarche <b>« %{libelle_demarche} »</b>.
link_html: |
Vous pouvez <b>retrouver et compléter votre dossier</b> en cliquant sur le bouton ci-dessous :
submit_before: Vous pouvez déposer votre dossier jusquau %{before}.
access_file: Afficher votre dossier

View file

@ -0,0 +1,9 @@
en:
dossier_mailer:
notify_revert_to_instruction:
subject: Your file nº %{dossier_id} « %{libelle_demarche} » will be reexamined
body_html: |
Your file nº %{dossier_id} will be reexamined. All previous decisions are void.
To see the file created on procedure <b>« %{libelle_demarche} »</b>, select the following link:
contact: |
In order to get more details about the decision to reexamin, please contact the following service:

View file

@ -0,0 +1,9 @@
fr:
dossier_mailer:
notify_revert_to_instruction:
subject: Votre dossier nº %{dossier_id} sur la démarche « %{libelle_demarche} » est en train dêtre réexaminé
body_html: |
Votre dossier va être réexaminé, la précédente décision sur ce dossier est caduque.
Vous pouvez retrouver le dossier que vous avez créé pour la démarche <b>« %{libelle_demarche} »</b> à l'adresse suivante :
contact: |
Pour obtenir le détail de cette modification de la décision, vous pouvez contacter par email :

View file

@ -0,0 +1,5 @@
class AddLocaleToUsers < ActiveRecord::Migration[6.1]
def change
add_column :users, :locale, :string
end
end

View file

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2021_08_18_083349) do ActiveRecord::Schema.define(version: 2021_08_26_161956) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -753,6 +753,7 @@ ActiveRecord::Schema.define(version: 2021_08_18_083349) do
t.bigint "instructeur_id" t.bigint "instructeur_id"
t.bigint "administrateur_id" t.bigint "administrateur_id"
t.bigint "expert_id" t.bigint "expert_id"
t.string "locale"
t.index ["administrateur_id"], name: "index_users_on_administrateur_id" t.index ["administrateur_id"], name: "index_users_on_administrateur_id"
t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
t.index ["email"], name: "index_users_on_email", unique: true t.index ["email"], name: "index_users_on_email", unique: true

View file

@ -202,8 +202,8 @@ RSpec.describe DossierMailer, type: :mailer do
subject { described_class.notify_groupe_instructeur_changed(instructeur, dossier) } subject { described_class.notify_groupe_instructeur_changed(instructeur, dossier) }
it { expect(subject.subject).to eq("Un dossier a changé de groupe instructeur") } it { expect(subject.subject).to eq("Le dossier nº #{dossier.id} a changé de groupe instructeur") }
it { expect(subject.body).to include("#{dossier.id}") } it { expect(subject.body).to include(" #{dossier.id}") }
it { expect(subject.body).to include(dossier.procedure.libelle) } it { expect(subject.body).to include(dossier.procedure.libelle) }
it { expect(subject.body).to include("Suite à cette modification, vous ne suivez plus ce dossier.") } it { expect(subject.body).to include("Suite à cette modification, vous ne suivez plus ce dossier.") }
end end