From 42964c91f37a27426aa52ac949da1972e0f7d317 Mon Sep 17 00:00:00 2001 From: Phillip Thelen Date: Fri, 26 Apr 2024 22:15:18 +0200 Subject: [PATCH] Fix issue with gift sub processing (#15184) * Fix issue with gift sub processing * Update cron.js --- website/server/libs/cron.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/website/server/libs/cron.js b/website/server/libs/cron.js index e65b643c89..6ee8930b3f 100644 --- a/website/server/libs/cron.js +++ b/website/server/libs/cron.js @@ -112,8 +112,12 @@ async function grantEndOfTheMonthPerks (user, now) { // (subtract 1 because we should have run this when the payment was taken last month) plan.consecutive.offset = planMonthsLength - 1; } - // eslint-disable-next-line no-await-in-loop - await plan.incrementPerkCounterAndReward(user._id, planMonthsLength); + if (!plan.gift && plan.customerId.indexOf('Gift') === -1) { + // Don't process gifted subs here, since they already got their perks. + + // eslint-disable-next-line no-await-in-loop + await plan.incrementPerkCounterAndReward(user._id, planMonthsLength); + } } } }