From 662349c8bbe95aa34d3ae3c81bec791dbeec3d85 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 10 Oct 2018 08:55:39 +0200 Subject: [PATCH] Remove InviteDossierFacades --- app/controllers/users/dossiers/invites_controller.rb | 9 +++++---- app/facades/invite_dossier_facades.rb | 6 ------ 2 files changed, 5 insertions(+), 10 deletions(-) delete mode 100644 app/facades/invite_dossier_facades.rb diff --git a/app/controllers/users/dossiers/invites_controller.rb b/app/controllers/users/dossiers/invites_controller.rb index c766a8ce0..1ab2e43ff 100644 --- a/app/controllers/users/dossiers/invites_controller.rb +++ b/app/controllers/users/dossiers/invites_controller.rb @@ -10,12 +10,13 @@ class Users::Dossiers::InvitesController < UsersController end def show - @facade = InviteDossierFacades.new params[:id].to_i, current_user.email + invite = Invite.where(email: current_user.email, id: params[:id].to_i).first! + dossier = invite.dossier - if @facade.dossier.brouillon? - redirect_to brouillon_dossier_path(@facade.dossier) + if dossier.brouillon? + redirect_to brouillon_dossier_path(dossier) else - return redirect_to dossier_path(@facade.dossier) + return redirect_to dossier_path(dossier) end rescue ActiveRecord::RecordNotFound flash.alert = t('errors.messages.dossier_not_found') diff --git a/app/facades/invite_dossier_facades.rb b/app/facades/invite_dossier_facades.rb deleted file mode 100644 index 138e0e131..000000000 --- a/app/facades/invite_dossier_facades.rb +++ /dev/null @@ -1,6 +0,0 @@ -class InviteDossierFacades < DossierFacades - # TODO rechercher en fonction de la personne/email - def initialize(id, email) - @dossier = Invite.where(email: email, id: id).first!.dossier - end -end