fix(dossier): redirect on not found dossiers

This commit is contained in:
Paul Chavard 2022-05-17 09:53:34 +02:00
parent ad5c659f88
commit 2eb7da5227

View file

@ -8,6 +8,7 @@ module Instructeurs
include ActionController::Streaming
include Zipline
before_action :redirect_on_dossier_not_found, only: :show
after_action :mark_demande_as_read, only: :show
after_action :mark_messagerie_as_read, only: [:messagerie, :create_commentaire]
after_action :mark_avis_as_read, only: [:avis, :create_avis]
@ -301,5 +302,11 @@ module Instructeurs
"Le dossier est en ce moment #{dossier_display_state(exception.originating_state, lower: true)} : il nest pas possible de le passer #{dossier_display_state(target_state, lower: true)}."
end
end
def redirect_on_dossier_not_found
if !current_instructeur.dossiers.visible_by_administration.exists?(id: params[:dossier_id])
redirect_to instructeur_procedure_path(procedure)
end
end
end
end