controller

This commit is contained in:
Kara Diaby 2022-08-30 21:41:04 +02:00
parent aab0c445de
commit 98f4250214
2 changed files with 9 additions and 1 deletions

View file

@ -60,9 +60,17 @@ module Experts
end
def update
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)
if !updated_recently
@avis.dossier.followers_instructeurs
.with_instant_expert_avis_email_notifications_enabled
.each do |instructeur|
DossierMailer.notify_new_avis_to_instructeur(@avis, instructeur.email).deliver_later
end
end
redirect_to instruction_expert_avis_path(@avis.procedure, @avis)
else
flash.now.alert = @avis.errors.full_messages

View file

@ -261,7 +261,7 @@ module Instructeurs
def assign_to_params
params.require(:assign_to)
.permit(:instant_email_dossier_notifications_enabled, :instant_email_message_notifications_enabled, :daily_email_notifications_enabled, :weekly_email_notifications_enabled)
.permit(:instant_expert_avis_email_notifications_enabled, :instant_email_dossier_notifications_enabled, :instant_email_message_notifications_enabled, :daily_email_notifications_enabled, :weekly_email_notifications_enabled)
end
def assign_exports