From d93bba08bbb22fdbd55c9fbe4335e172df2c2b2b Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Thu, 9 Jan 2025 10:54:04 +0100 Subject: [PATCH] [#10950] Add link in email so use can recreate a dossier --- app/models/dossier.rb | 2 +- app/views/dossier_mailer/notify_brouillon_deletion.html.haml | 3 +-- spec/mailers/dossier_mailer_spec.rb | 4 +++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/models/dossier.rb b/app/models/dossier.rb index f722d72edc2..677ea9a4ee9 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -932,7 +932,7 @@ def linked_dossiers_for(instructeur_or_expert) end def hash_for_deletion_mail - { id: self.id, procedure_libelle: self.procedure.libelle } + { id: self.id, procedure_libelle: self.procedure.libelle, procedure_path: self.procedure.path } end def geo_data? diff --git a/app/views/dossier_mailer/notify_brouillon_deletion.html.haml b/app/views/dossier_mailer/notify_brouillon_deletion.html.haml index a6b1312d11f..70a7613acb5 100644 --- a/app/views/dossier_mailer/notify_brouillon_deletion.html.haml +++ b/app/views/dossier_mailer/notify_brouillon_deletion.html.haml @@ -6,6 +6,5 @@ = t('.header', count: @dossier_hashes.size) %ul - @dossier_hashes.each do |d| - %li n° #{d[:id]} (#{d[:procedure_libelle]}) - + %li n° #{d[:id]} (#{link_to d[:procedure_libelle], commencer_url(d[:procedure_path])}) = render partial: "layouts/mailers/signature" diff --git a/spec/mailers/dossier_mailer_spec.rb b/spec/mailers/dossier_mailer_spec.rb index f456f385537..91654f98c06 100644 --- a/spec/mailers/dossier_mailer_spec.rb +++ b/spec/mailers/dossier_mailer_spec.rb @@ -124,7 +124,9 @@ def notify_deletion_to_administration(hidden_dossier, to_email) it 'verifies subject and body content for brouillon deletion notification' do expect(subject.subject).to eq("Un dossier en brouillon a été supprimé") - expect(subject.body).to include("n° #{dossier.id} (#{dossier.procedure.libelle})") + expect(subject.body).to include("n° #{dossier.id}") + expect(subject.body).to include(dossier.procedure.libelle) + expect(subject.body).to include(commencer_url(dossier.procedure.path, host: ENV.fetch("APP_HOST_LEGACY"))) end end