0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Updated getMember to return plans

no-issue

Plans are distinct from subscriptions, as in theory a subscription could
have many plans. These moves the construction of the plans array into
the getMember function so that every consumer has access to the same
data.
This commit is contained in:
Fabien O'Carroll 2019-04-25 13:13:45 +02:00
parent b207ea35ec
commit 70343f7923

View file

@ -39,8 +39,10 @@ module.exports = function ({
});
}));
}).then((subscriptions) => {
const activeSubscriptions = subscriptions.filter(sub => sub.status === 'active');
return Object.assign({}, member, {
subscriptions: subscriptions.filter(sub => sub.status === 'active')
subscriptions: activeSubscriptions,
plans: activeSubscriptions.map(sub => sub.plan)
});
});
});