From 2d57ec4056954c469b1c74a7be53e60198228345 Mon Sep 17 00:00:00 2001 From: Colin Darie Date: Thu, 16 May 2024 16:18:35 +0200 Subject: [PATCH] fix(accuse-lecture): don't crash on dossier acceptance when procedure is still draft --- app/services/mail_template_presenter_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/mail_template_presenter_service.rb b/app/services/mail_template_presenter_service.rb index b0e9db3bb7a..f816f3a05ae 100644 --- a/app/services/mail_template_presenter_service.rb +++ b/app/services/mail_template_presenter_service.rb @@ -4,7 +4,7 @@ class MailTemplatePresenterService def self.create_commentaire_for_state(dossier, state) if dossier.procedure.accuse_lecture? && Dossier::TERMINE.include?(state) - CommentaireService.create!(CONTACT_EMAIL, dossier, body: I18n.t('layouts.mailers.accuse_lecture.commentaire_html', service: dossier.procedure.service.nom)) + CommentaireService.create!(CONTACT_EMAIL, dossier, body: I18n.t('layouts.mailers.accuse_lecture.commentaire_html', service: dossier.procedure.service&.nom)) else service = new(dossier, state) body = ["

[#{service.safe_subject}]

", service.safe_body].join('')