feat: Creation of a rake task to delete duplicated half signup users #651
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🎩 Description
This PR adds a rake task that will delete duplicated half signup users, and alert the administrator about the decidim accounts that contains a phone number that might be duplicated in the DB (multiple decidim accounts with the same phone number)
Testing
Describe the best way to test or validate your PR.
You might need to update manually your DB except if you have a dump that has the bug inside of it
Generate your App
Access to the db generated with your application
Access the table decidim-users
Target a dozen of users that you can easily update (that were not already deleted or blocked on the organization)
For a multiple case scenarios I would recommend to change 6 users to match the "quick_auth" regex email and to let 6 decidim users with "classic" emails
For 3 of each, add an identical phone_number with an identical phone_country
For 1 of each, add an identical phone_number with a different phone_country
For 2 of each, add a different phone number (different for each of them) regardless the phone_country
Make sure that when you execute the rake task
bundle exec rake decidim:clear_duplicated_user
that you have every logs in your stdoutIf you followed the test scenario above :
Every quick_auth with the same phone_number and same phone_country should have been deleted.
Decidim users with the same phone_number and same phone_country should have been alerted to you with the last stdout
Users with an identical phone_number with a different phone_country should not have been alerted to you
Users with a different phone_number should not have been alerted to you
Tasks