Merge pull request #2791 from betagouv/remove-facade

Remove InviteDossierFacades
This commit is contained in:
gregoirenovel 2018-10-10 10:28:56 +02:00 committed by GitHub
commit a5f71bfaf6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 10 deletions

View file

@ -10,12 +10,13 @@ class Users::Dossiers::InvitesController < UsersController
end end
def show 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? if dossier.brouillon?
redirect_to brouillon_dossier_path(@facade.dossier) redirect_to brouillon_dossier_path(dossier)
else else
return redirect_to dossier_path(@facade.dossier) return redirect_to dossier_path(dossier)
end end
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
flash.alert = t('errors.messages.dossier_not_found') flash.alert = t('errors.messages.dossier_not_found')

View file

@ -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