0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Fixed issue with new members always subscribing to defaults

no issue

The member was updated when setting the geolocation, but that also included setting subscribed to true.
This commit is contained in:
Simon Backx 2022-04-28 13:16:30 +02:00
parent 266fd79168
commit ae10696e95

View file

@ -234,10 +234,7 @@ module.exports = function MembersAPI({
await MemberLoginEvent.add({member_id: member.id});
if (oldEmail) {
// user exists but wants to change their email address
if (oldEmail) {
member.email = email;
}
await users.update(member, {id: member.id});
await users.update({email}, {id: member.id});
return getMemberIdentityData(email);
}
return member;
@ -279,8 +276,7 @@ module.exports = function MembersAPI({
// max request time is 500ms so shouldn't slow requests down too much
let geolocation = JSON.stringify(await geolocationService.getGeolocationFromIP(ip));
if (geolocation) {
member.geolocation = geolocation;
await users.update(member, {id: member.id});
await users.update({geolocation}, {id: member.id});
}
return getMemberIdentityData(email);