diff --git a/app/components/dossiers/message_component.rb b/app/components/dossiers/message_component.rb index 1dceaf4ff..16244c2a6 100644 --- a/app/components/dossiers/message_component.rb +++ b/app/components/dossiers/message_component.rb @@ -55,15 +55,6 @@ class Dossiers::MessageComponent < ApplicationComponent l(commentaire.created_at, format: is_current_year ? :message_date : :message_date_with_year) end - def commentaire_body - if commentaire.discarded? - t('.deleted_body') - else - body_formatted = commentaire.sent_by_system? ? commentaire.body : simple_format(commentaire.body) - sanitize(body_formatted, commentaire.sent_by_system? ? { scrubber: Sanitizers::MailScrubber.new } : {}) - end - end - def highlight? commentaire.created_at.present? && @messagerie_seen_at&.<(commentaire.created_at) end diff --git a/app/components/dossiers/message_component/message_component.html.haml b/app/components/dossiers/message_component/message_component.html.haml index 1a95635cc..2785815a2 100644 --- a/app/components/dossiers/message_component/message_component.html.haml +++ b/app/components/dossiers/message_component/message_component.html.haml @@ -8,7 +8,14 @@ %span.fr-text--xs.fr-text-mention--grey.font-weight-normal= t('.guest') %span.date{ class: ["fr-text--xs", "fr-text-mention--grey", "font-weight-normal", highlight_if_unseen_class], data: scroll_to_target } = commentaire_date - .rich-text= commentaire_body + .rich-text + - if commentaire.discarded? + %p= t('.deleted_body') + - elsif commentaire.sent_by_system? + = sanitize(commentaire.body, scrubber: Sanitizers::MailScrubber.new) + - else + = render SimpleFormatComponent.new(commentaire.body, allow_a: false) + .message-extras.flex.justify-start - if commentaire.soft_deletable?(connected_user)