Conversation
stuzart
left a comment
There was a problem hiding this comment.
A couple of minor comments on the main code, and the need to merge annotations the person has made.
Main concern is that the tests aren't robust enough, needs expanding a bit and more explicit checking. For this it is more important that the tests are really robust
| def merge_user(other_person) | ||
| return unless user && other_person.user | ||
|
|
||
| merge_user_associations(other_person, 'identities', | ||
| %i[provider uid], { user_id: user.id }) | ||
| merge_user_associations(other_person, 'oauth_applications', | ||
| %i[redirect_uri scopes], { owner_id: user.id }) | ||
| merge_user_associations(other_person, 'access_tokens', | ||
| %i[application_id scopes], { resource_owner_id: user.id }) | ||
| merge_user_associations(other_person, 'access_grants', | ||
| %i[application_id redirect_uri scopes], { resource_owner_id: user.id }) | ||
| end |
There was a problem hiding this comment.
the auth lookup table should update automatically. rows will be removed when the user is destroyed (another case where we can enhance the delete_all). After it's merged I also plan to check what jobs get created, or whether it just needs a job firing at the end
|
Maybe useful: List of tables that reference |
|
Just some notes on the comment above: with accompanying tests. User: with accompanying tests. |

Adds methods and tests to be able to merge two accounts, transferring all the relevant associations without duplication.
Resolves #1666.