mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +03:00
🐛 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:
parent
40aabc7539
commit
ca473fc273
@ -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({
|
||||
|
Loading…
Reference in New Issue
Block a user