feat(gallery): notify instructeur if pieces jointes added in avis
This commit is contained in:
parent
8d8e290659
commit
ad98bafeca
3 changed files with 9 additions and 3 deletions
app
|
@ -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
|
||||
|
|
|
@ -378,7 +378,8 @@ class Dossier < ApplicationRecord
|
|||
' OR last_avis_updated_at > follows.avis_seen_at' \
|
||||
' OR last_commentaire_updated_at > follows.messagerie_seen_at' \
|
||||
' OR last_commentaire_piece_jointe_updated_at > follows.pieces_jointes_seen_at' \
|
||||
' OR last_champ_piece_jointe_updated_at > follows.pieces_jointes_seen_at')
|
||||
' OR last_champ_piece_jointe_updated_at > follows.pieces_jointes_seen_at' \
|
||||
' OR last_avis_piece_jointe_updated_at > follows.pieces_jointes_seen_at')
|
||||
.distinct
|
||||
end
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ class Instructeur < ApplicationRecord
|
|||
annotations_privees = dossier.last_champ_private_updated_at&.>(follow.annotations_privees_seen_at) || false
|
||||
avis_notif = dossier.last_avis_updated_at&.>(follow.avis_seen_at) || false
|
||||
messagerie = dossier.last_commentaire_updated_at&.>(follow.messagerie_seen_at) || false
|
||||
pieces_jointes = dossier.last_champ_piece_jointe_updated_at&.>(follow.pieces_jointes_seen_at) || dossier.last_commentaire_piece_jointe_updated_at&.>(follow.pieces_jointes_seen_at) || false
|
||||
pieces_jointes = dossier.last_champ_piece_jointe_updated_at&.>(follow.pieces_jointes_seen_at) || dossier.last_commentaire_piece_jointe_updated_at&.>(follow.pieces_jointes_seen_at) || dossier.last_avis_piece_jointe_updated_at&.>(follow.pieces_jointes_seen_at) || false
|
||||
|
||||
annotations_hash(demande, annotations_privees, avis_notif, messagerie, pieces_jointes)
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue