Award mystery items at cron (#11519)

* feat(subscriber): award mystery items at cron

* fix(mystery): backfill skipped months

* fix(mystery): adjust subscriber text

* fix(mystery): correct moment logic
and remove irrelevant tests

* fix(mystery): build set one month in advance

* fix(mystery): don't add empty set to Time Travelers

* refactor(mystery): readability
This commit is contained in:
Sabe Jones
2019-11-27 12:10:56 -06:00
committed by GitHub
parent d0033322f7
commit 6395070eb6
7 changed files with 59 additions and 310 deletions

View File

@@ -6,6 +6,7 @@ import { model as User } from '../models/user';
import common from '../../common';
import { preenUserHistory } from './preening';
import sleep from './sleep';
import { revealMysteryItems } from './payments/subscriptions';
const CRON_SAFE_MODE = nconf.get('CRON_SAFE_MODE') === 'true';
const CRON_SEMI_SAFE_MODE = nconf.get('CRON_SEMI_SAFE_MODE') === 'true';
@@ -75,6 +76,9 @@ function grantEndOfTheMonthPerks (user, now) {
count: 0, offset: 0, trinkets: 0, gemCapExtra: 0,
});
// Award mystery items
revealMysteryItems(user, elapsedMonths);
// 1 for one-month recurring or gift subscriptions; later set to 3 for 3-month recurring, etc.
let planMonthsLength = 1;