= render partial: 'shared/dossiers/messages/message_icon', locals: { commentaire: commentaire, connected_user: connected_user }

.width-100
  %h2
    %span.mail
      = render partial: 'shared/dossiers/messages/message_issuer', locals: { commentaire: commentaire, connected_user: connected_user }
    - if commentaire_is_from_guest(commentaire)
      %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))

  .message-extras.flex.justify-start
    - if commentaire.piece_jointe.attached?
      .attachment-link
        = render partial: "shared/attachment/show", locals: { attachment: commentaire.piece_jointe.attachment }
    - elsif commentaire.file.present?
      .attachment-link
        = link_to commentaire.file_url, class: "button", target: "_blank", rel: "noopener", title: "Télécharger" do
          %span.icon.attachment
          = commentaire.file_identifier

    - if show_reply_button
      = button_tag type: 'button', class: 'button small message-answer-button', onclick: 'document.querySelector("#commentaire_body").focus()' do
        %span.icon.reply
        Répondre

= render partial: 'shared/dossiers/messages/message_icon', locals: { commentaire: commentaire, connected_user: connected_user }

.width-100
  %h2
    %span.mail
      = render partial: 'shared/dossiers/messages/message_issuer', locals: { commentaire: commentaire, connected_user: connected_user }
    - if commentaire_is_from_guest(commentaire)
      %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))

  .message-extras.flex.justify-start
    - if commentaire.piece_jointe.attached?
      .attachment-link
        = render partial: "shared/attachment/show", locals: { attachment: commentaire.piece_jointe.attachment }

    - if show_reply_button
      = button_tag type: 'button', class: 'button small message-answer-button', onclick: 'document.querySelector("#commentaire_body").focus()' do
        %span.icon.reply
        Répondre

Remove last reference to commentaire.file
Remove last reference to commentaire.file
