feat(gallery): notify instructeur if pieces jointes added in avis

This commit is contained in:
Eric Leroy-Terquem 2024-10-10 09:41:28 +02:00
parent 8d8e290659
commit ad98bafeca
No known key found for this signature in database
GPG key ID: 53D8FAECEF207605
3 changed files with 9 additions and 3 deletions

View file

@ -104,7 +104,12 @@ module Experts
updated_recently = @avis.updated_recently?
if @avis.update(avis_params)
flash.notice = 'Votre réponse est enregistrée.'
@avis.dossier.update!(last_avis_updated_at: Time.zone.now)
timestamps = [:last_avis_updated_at, :updated_at]
timestamps << :last_avis_piece_jointe_updated_at if @avis.piece_justificative_file.attached?
@avis.dossier.touch(*timestamps)
if !updated_recently
@avis.dossier.followers_instructeurs
.with_instant_expert_avis_email_notifications_enabled