mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-28 21:33:24 +03:00
Fixed missing subscription data in member update endpoint
closes https://github.com/TryGhost/members.js/issues/94 - The member-api package was recently updated to work directly with models and needs explicit `withRelated` options to attack relations - Without options, the endpoint was returning the default member data without subscriptions attached, which in Portal showed paid member as free - Fix updates the middleware for updating member data to correctly pass the relations needed to populate the member
This commit is contained in:
parent
dd6ac57aca
commit
2d2fa1a0ba
@ -71,7 +71,12 @@ const updateMemberData = async function (req, res) {
|
|||||||
const data = _.pick(req.body, 'name', 'subscribed');
|
const data = _.pick(req.body, 'name', 'subscribed');
|
||||||
const member = await membersService.ssr.getMemberDataFromSession(req, res);
|
const member = await membersService.ssr.getMemberDataFromSession(req, res);
|
||||||
if (member) {
|
if (member) {
|
||||||
const updatedMember = await membersService.api.members.update(data, {id: member.id});
|
const options = {
|
||||||
|
id: member.id,
|
||||||
|
withRelated: ['stripeSubscriptions', 'stripeSubscriptions.customer']
|
||||||
|
};
|
||||||
|
const updatedMember = await membersService.api.members.update(data, options);
|
||||||
|
|
||||||
res.json(formattedMemberResponse(updatedMember.toJSON()));
|
res.json(formattedMemberResponse(updatedMember.toJSON()));
|
||||||
} else {
|
} else {
|
||||||
res.json(null);
|
res.json(null);
|
||||||
|
Loading…
Reference in New Issue
Block a user