controllers

This commit is contained in:
Kara Diaby 2023-03-23 17:14:15 +01:00
parent ba8d78bd97
commit 74e4e2a1ce
2 changed files with 15 additions and 1 deletions

View file

@ -7,6 +7,7 @@ module Experts
before_action :check_if_avis_revoked, except: [:index, :procedure]
before_action :redirect_if_no_sign_up_needed, only: [:sign_up, :update_expert]
before_action :set_avis_and_dossier, only: [:show, :instruction, :avis_list, :avis_new, :messagerie, :create_commentaire, :delete_commentaire, :update, :telecharger_pjs]
before_action :check_messaging_allowed, only: [:messagerie, :create_commentaire]
A_DONNER_STATUS = 'a-donner'
DONNES_STATUS = 'donnes'
@ -155,6 +156,13 @@ module Experts
private
def check_messaging_allowed
if !@avis.procedure.allow_expert_messaging
flash[:alert] = "Vous n'êtes pas autorisé à acceder à la messagerie"
redirect_to expert_avis_url(avis.procedure, avis)
end
end
def redirect_if_no_sign_up_needed
avis = Avis.find(params[:id])