correctif(a11y): #8105 format les messages de la messageries avec la nouvelle methode pour rendre les textes saisies par les admin et les instructeurs

This commit is contained in:
Martin 2023-02-22 11:10:09 +01:00 committed by mfo
parent a68d89b183
commit fd203f5bb7
2 changed files with 8 additions and 10 deletions

View file

@ -55,15 +55,6 @@ class Dossiers::MessageComponent < ApplicationComponent
l(commentaire.created_at, format: is_current_year ? :message_date : :message_date_with_year) l(commentaire.created_at, format: is_current_year ? :message_date : :message_date_with_year)
end 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? def highlight?
commentaire.created_at.present? && @messagerie_seen_at&.<(commentaire.created_at) commentaire.created_at.present? && @messagerie_seen_at&.<(commentaire.created_at)
end end

View file

@ -8,7 +8,14 @@
%span.fr-text--xs.fr-text-mention--grey.font-weight-normal= t('.guest') %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 } %span.date{ class: ["fr-text--xs", "fr-text-mention--grey", "font-weight-normal", highlight_if_unseen_class], data: scroll_to_target }
= commentaire_date = 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 .message-extras.flex.justify-start
- if commentaire.soft_deletable?(connected_user) - if commentaire.soft_deletable?(connected_user)