mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
set purchased.plan.dateUpdated during cron if it hasn't been set - ref https://github.com/HabitRPG/habitrpg/issues/6682
This commit is contained in:
@@ -2415,6 +2415,10 @@ api.wrap = function(user, main) {
|
||||
};
|
||||
plan = (ref = user.purchased) != null ? ref.plan : void 0;
|
||||
if (plan != null ? plan.customerId : void 0) {
|
||||
if (typeof plan.dateUpdated === "undefined") {
|
||||
// partial compensation for bug in subscription creation - https://github.com/HabitRPG/habitrpg/issues/6682
|
||||
plan.dateUpdated = new Date();
|
||||
}
|
||||
if (moment(plan.dateUpdated).format('MMYYYY') !== moment().format('MMYYYY')) {
|
||||
plan.gemsBought = 0;
|
||||
plan.dateUpdated = new Date();
|
||||
|
||||
Reference in New Issue
Block a user