[agent] do not consider soft deleted users in uniqueness checks
Created by: adipasquale
https://trello.com/c/MbRWv7GQ/972-impossible-de-recr%C3%A9er-un-usager-supprim%C3%A9
I fixed 2 different issues preventing re-creating a user that was soft-deleted :
-
scope to active users in DuplicateUserFinder => pretty obvious
-
bypass users.email unicity => more tricky. The email unicity constraint is at the db level so we cannot just change the scope of the validation (and maybe it's best like that). What I did was that now soft deleted users have a dummy email like
user_34@deleted.rdv-solidarites.fr
and their original email is backuped inusers.email_original
. this allows re-creating a new user with the old email.
Also, I couldn't refrain from a little refacto of the user#soft_delete
method please indulge me.