From e7c88d6e5d74d6cab9b077e151ce651ef4bb5311 Mon Sep 17 00:00:00 2001 From: Alys Date: Tue, 9 Feb 2016 20:51:32 +1000 Subject: [PATCH] set purchased.plan.dateUpdated during cron if it hasn't been set - ref https://github.com/HabitRPG/habitrpg/issues/6682 --- common/script/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/script/index.js b/common/script/index.js index e3befc9aa6..ec396e710e 100644 --- a/common/script/index.js +++ b/common/script/index.js @@ -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();