mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +03:00
🐛 Fixed re-enabling of complimentary subscriptions
closes #12503 Since we include _all_ subscriptions in the `stripeSubscriptions` relation, we must check that for an existing active complimentary subscription to decide whether or not we should skip creation of a complimentary subscription
This commit is contained in:
parent
7528ec8c3b
commit
81218ab467
@ -192,7 +192,7 @@ module.exports = {
|
|||||||
frame.options.withRelated = ['stripeSubscriptions'];
|
frame.options.withRelated = ['stripeSubscriptions'];
|
||||||
const member = await membersService.api.members.update(frame.data.members[0], frame.options);
|
const member = await membersService.api.members.update(frame.data.members[0], frame.options);
|
||||||
|
|
||||||
const hasCompedSubscription = !!member.related('stripeSubscriptions').find(subscription => subscription.get('plan_nickname') === 'Complimentary');
|
const hasCompedSubscription = !!member.related('stripeSubscriptions').find(sub => sub.get('plan_nickname') === 'Complimentary' && sub.get('status') === 'active');
|
||||||
|
|
||||||
if (typeof frame.data.members[0].comped === 'boolean') {
|
if (typeof frame.data.members[0].comped === 'boolean') {
|
||||||
if (frame.data.members[0].comped && !hasCompedSubscription) {
|
if (frame.data.members[0].comped && !hasCompedSubscription) {
|
||||||
|
Loading…
Reference in New Issue
Block a user