Merge branch 'dev'

This commit is contained in:
gregoirenovel 2018-10-10 10:45:12 +02:00
commit 310d193173
3 changed files with 20 additions and 14 deletions

View file

@ -1,21 +1,23 @@
class Users::Dossiers::InvitesController < UsersController
def authenticate_user!
session["user_return_to"] = request.fullpath
email = params[:email]
if params[:email].present? && User.find_by(email: params[:email]).nil?
return redirect_to new_user_registration_path(user: { email: params[:email] })
if email.present? && User.find_by(email: email).nil?
redirect_to new_user_registration_path(user: { email: email })
else
super
end
super
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)
redirect_to dossier_path(dossier)
end
rescue ActiveRecord::RecordNotFound
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

View file

@ -0,0 +1,10 @@
namespace :after_party do
desc 'Deployment task: remove_invite_gestionnaires'
task remove_invite_gestionnaires: :environment do
InviteGestionnaire.destroy_all
# Update task as completed. If you remove the line below, the task will
# run with every deploy (or every time you call after_party:run).
AfterParty::TaskRecord.create version: '20181010102500'
end
end