From eea5fd66ade48520978c1c98a5922d394fcbe93f Mon Sep 17 00:00:00 2001 From: Christophe Robillard Date: Mon, 10 Aug 2020 16:02:11 +0200 Subject: [PATCH] corrige mise en forme commentaire --- app/helpers/commentaire_helper.rb | 5 +++++ app/views/shared/dossiers/messages/_message.html.haml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/helpers/commentaire_helper.rb b/app/helpers/commentaire_helper.rb index aae8dc85d..78e207b91 100644 --- a/app/helpers/commentaire_helper.rb +++ b/app/helpers/commentaire_helper.rb @@ -22,4 +22,9 @@ module CommentaireHelper template = is_current_year ? :message_date : :message_date_with_year I18n.l(commentaire.created_at, format: template) end + + def pretty_commentaire(commentaire) + body_formatted = commentaire.sent_by_system? ? commentaire.body : simple_format(commentaire.body) + sanitize(body_formatted) + end end diff --git a/app/views/shared/dossiers/messages/_message.html.haml b/app/views/shared/dossiers/messages/_message.html.haml index 885f33c23..d62012782 100644 --- a/app/views/shared/dossiers/messages/_message.html.haml +++ b/app/views/shared/dossiers/messages/_message.html.haml @@ -8,7 +8,7 @@ %span.guest Invité %span.date{ class: highlight_if_unseen_class(messagerie_seen_at, commentaire.created_at) } = commentaire_date(commentaire) - .rich-text= sanitize(simple_format(commentaire.body)) + .rich-text= pretty_commentaire(commentaire) .message-extras.flex.justify-start - if commentaire.piece_jointe.attached?