feat(gallery): notify instructeur if pieces jointes updates

This commit is contained in:
Eric Leroy-Terquem 2024-09-10 16:09:43 +02:00
parent 5153b9a3ff
commit d9f604e8ce
No known key found for this signature in database
GPG key ID: 53D8FAECEF207605
9 changed files with 47 additions and 19 deletions

View file

@ -18,6 +18,7 @@ module Instructeurs
after_action :mark_messagerie_as_read, only: [:messagerie, :create_commentaire, :pending_correction]
after_action :mark_avis_as_read, only: [:avis, :create_avis]
after_action :mark_annotations_privees_as_read, only: [:annotations_privees, :update_annotations]
after_action :mark_pieces_jointes_as_read, only: [:pieces_jointes]
def extend_conservation
dossier.extend_conservation(1.month)
@ -466,6 +467,10 @@ module Instructeurs
current_instructeur.mark_tab_as_seen(dossier, :annotations_privees)
end
def mark_pieces_jointes_as_read
current_instructeur.mark_tab_as_seen(dossier, :pieces_jointes)
end
def aasm_error_message(exception, target_state:)
if exception.originating_state == target_state
"Le dossier est déjà #{dossier_display_state(target_state, lower: true)}."

View file

@ -341,7 +341,10 @@ module Users
@commentaire = CommentaireService.create(current_user, dossier, commentaire_params)
if @commentaire.errors.empty?
@commentaire.dossier.update!(last_commentaire_updated_at: Time.zone.now)
timestamps = [:last_commentaire_updated_at, :updated_at]
timestamps << :last_commentaire_piece_jointe_updated_at if @commentaire.piece_jointe.attached?
@commentaire.dossier.touch(*timestamps)
flash.notice = t('.message_send')
redirect_to messagerie_dossier_path(dossier)