Ajoute un flag pour qu'un expert ne puisse pas inviter une autre personne à donner son avis sur un dossier
This commit is contained in:
parent
cf08c7c40d
commit
9207cc5aa5
5 changed files with 44 additions and 6 deletions
|
@ -82,6 +82,10 @@ class ApplicationController < ActionController::Base
|
|||
Flipper.enabled?(feature_name, current_user)
|
||||
end
|
||||
|
||||
def feature_enabled_for?(feature_name, item)
|
||||
Flipper.enabled?(feature_name, item)
|
||||
end
|
||||
|
||||
def authenticate_logged_user!
|
||||
if instructeur_signed_in?
|
||||
authenticate_instructeur!
|
||||
|
|
|
@ -71,13 +71,19 @@ module Instructeurs
|
|||
end
|
||||
|
||||
def create_avis
|
||||
@new_avis = create_avis_from_params(avis.dossier, avis.confidentiel)
|
||||
@procedure = Procedure.find(params[:procedure_id])
|
||||
if !feature_enabled_for?(:expert_not_allowed_to_invite, @procedure)
|
||||
@new_avis = create_avis_from_params(avis.dossier, avis.confidentiel)
|
||||
|
||||
if @new_avis.nil?
|
||||
redirect_to instruction_instructeur_avis_path(avis.procedure, avis)
|
||||
if @new_avis.nil?
|
||||
redirect_to instruction_instructeur_avis_path(avis.procedure, avis)
|
||||
else
|
||||
set_avis_and_dossier
|
||||
render :instruction
|
||||
end
|
||||
else
|
||||
set_avis_and_dossier
|
||||
render :instruction
|
||||
flash.alert = "Cette démarche ne vous permet pas de demander un avis externe"
|
||||
redirect_to instruction_instructeur_avis_path(avis.procedure, avis)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue