From 81218ab467fdc3de3ab11a0853cf3d9d039809ae Mon Sep 17 00:00:00 2001 From: Fabien O'Carroll Date: Mon, 4 Jan 2021 17:12:57 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20re-enabling=20of=20compl?= =?UTF-8?q?imentary=20subscriptions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- core/server/api/canary/members.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/server/api/canary/members.js b/core/server/api/canary/members.js index a965781ed1..174f1f4df2 100644 --- a/core/server/api/canary/members.js +++ b/core/server/api/canary/members.js @@ -192,7 +192,7 @@ module.exports = { frame.options.withRelated = ['stripeSubscriptions']; 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 (frame.data.members[0].comped && !hasCompedSubscription) {