🐛 Fixed potential member data loss when assigning geolocation data

no issue

- `setMemberGeolocationFromIp()` was passing a raw model instance through to `users.update()` rather than a data object causing the `model.edit()` call to overwrite existing data such as labels because `modelInstance.labels` is a function rather than an array
- removed unnecessary `withRelated: ['labels']` as it's not necessary for the update, member data is fetched again with all necessary includes by `getMemberIdentityData()` before returning
This commit is contained in:
Kevin Ansfield 2021-05-10 11:22:52 +01:00
parent 40aabc7539
commit ca473fc273

View File

@ -283,9 +283,9 @@ module.exports = function MembersApi({
});
}
const member = await users.get({email}, {
withRelated: ['labels']
});
// toJSON() is needed here otherwise users.update() will pick methods off
// the model object rather than data and fail to edit correctly
const member = (await users.get({email})).toJSON();
if (!member) {
throw new common.errors.NotFoundError({