feat(correction): deleting a comment resolves the related correction

Cf #9731
This commit is contained in:
Colin Darie 2023-12-07 15:41:50 +01:00
parent f27ef80553
commit accd7864ff
10 changed files with 72 additions and 9 deletions

View file

@ -17,10 +17,22 @@ class Dossiers::MessageComponent < ApplicationComponent
private
def soft_deletable?
commentaire.soft_deletable?(connected_user)
end
def show_reply_button?
@show_reply_button
end
def delete_button_text
if commentaire.dossier_correction&.pending?
t('.delete_with_correction_button')
else
t('.delete_button')
end
end
def highlight_if_unseen_class
if highlight?
'highlighted'

View file

@ -3,6 +3,7 @@ en:
reply: Reply
guest: Guest
delete_button: Delete this message
delete_with_correction_button: Delete the correction and this message
confirm: Are you sure you want to delete this message ?
automatic_email: Automatic email
you: You

View file

@ -3,6 +3,7 @@ fr:
reply: Répondre
guest: Invité
delete_button: Supprimer le message
delete_with_correction_button: Supprimer la demande de correction et ce message
confirm: Êtes-vous sûr de vouloir supprimer ce message ?
automatic_email: Email automatique
you: Vous

View file

@ -13,7 +13,7 @@
= commentaire_date
.rich-text
- if commentaire.discarded?
%p= t('.deleted_body')
%p= "(#{t('.deleted_body')})"
- elsif commentaire.sent_by_system?
= sanitize(commentaire.body, scrubber: Sanitizers::MailScrubber.new)
- else
@ -21,9 +21,9 @@
.message-extras.flex.justify-start
- if commentaire.soft_deletable?(connected_user)
- if soft_deletable?
= button_to instructeur_commentaire_path(commentaire.dossier.procedure, commentaire.dossier, commentaire), method: :delete, class: 'fr-btn fr-btn--sm fr-btn--tertiary fr-icon-delete-line fr-btn--icon-left fr-text-default--warning', form: { data: { turbo: true, turbo_confirm: t('.confirm') } } do
= t('.delete_button')
= delete_button_text
- if commentaire.piece_jointe.attached?
.fr-ml-2w