Fix issue with gift sub processing (#15184)

* Fix issue with gift sub processing

* Update cron.js
This commit is contained in:
Phillip Thelen 2024-04-26 22:15:18 +02:00 committed by GitHub
parent 2e9573ef92
commit 42964c91f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);
}
}
}
}