avoid redirection to a deleted user
This commit is contained in:
parent
8e2122cb62
commit
a0c0520502
2 changed files with 5 additions and 2 deletions
|
@ -13,13 +13,14 @@ module Manager
|
||||||
else
|
else
|
||||||
flash[:error] = user.errors.full_messages.to_sentence
|
flash[:error] = user.errors.full_messages.to_sentence
|
||||||
end
|
end
|
||||||
|
|
||||||
|
redirect_to edit_manager_user_path(user)
|
||||||
else
|
else
|
||||||
targeted_user.merge(user)
|
targeted_user.merge(user)
|
||||||
|
|
||||||
flash[:notice] = "Le compte « #{targeted_email} » a absorbé le compte « #{user.email} »."
|
flash[:notice] = "Le compte « #{targeted_email} » a absorbé le compte « #{user.email} »."
|
||||||
|
redirect_to edit_manager_user_path(targeted_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
redirect_to edit_manager_user_path(user)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def resend_confirmation_instructions
|
def resend_confirmation_instructions
|
||||||
|
|
|
@ -29,6 +29,7 @@ describe Manager::UsersController, type: :controller do
|
||||||
subject
|
subject
|
||||||
|
|
||||||
expect(User.find_by(id: user.id).email).to eq(nouvel_email)
|
expect(User.find_by(id: user.id).email).to eq(nouvel_email)
|
||||||
|
expect(response).to redirect_to(edit_manager_user_path(user))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -54,6 +55,7 @@ describe Manager::UsersController, type: :controller do
|
||||||
subject
|
subject
|
||||||
|
|
||||||
expect(flash[:notice]).to match("Le compte « email.existant@domaine.fr » a absorbé le compte « ancien.email@domaine.fr ».")
|
expect(flash[:notice]).to match("Le compte « email.existant@domaine.fr » a absorbé le compte « ancien.email@domaine.fr ».")
|
||||||
|
expect(response).to redirect_to(edit_manager_user_path(targeted_user))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue