Repository navigation
-
@lowdefy/modules-mongodb-user-admin: ### Patch Changes
-
#324
64c8292Thanks @machielvdw! - A person whose login identity was deleted can now be re-invited and save their profile. user-admin's Delete login identity hard-deleted the user row but left the person's contact pointing at the deleted user id. When an admin re-invited the person, they signed in under a new user id, and onboarding stopped with "We couldn't save your profile": the contact could not be claimed, because the claim only takes a contact with nouser_id. Once the login is deleted,delete-usernow unsetsuser_idon the person's contact, stamped withupdated, so the re-invited person's onboarding profile save claims the contact by address. A delete that is refused leaves the contact linked.Nothing to change in config to upgrade; upgrade every module and
@lowdefy/modules-mongodb-pluginstogether, as always. Contacts that an earlier delete left linked stay stuck until theiruser_idis unset. To find them, list the contacts whoseuser_idnames no user:db["user-contacts"].aggregate([ { $match: { user_id: { $exists: true } } }, { $lookup: { from: "users", localField: "user_id", foreignField: "_id", as: "user", }, }, { $match: { user: { $size: 0 } } }, { $project: { email: 1, user_id: 1 } }, ]);
Unset
user_idon those contacts with$unset, never by setting it tonull: theuser_idindex is unique and partial on$exists, so a storednullcollides with the next unlinked contact.