Cleanup pinned items that are no longer for purchase

This commit is contained in:
Phillip Thelen
2024-04-08 15:41:51 +02:00
parent 4cdfefd92b
commit d7dc878b1c
5 changed files with 185 additions and 22 deletions

View File

@@ -7,6 +7,7 @@ import common from '../../common';
import { preenUserHistory } from './preening';
import { sleep } from './sleep';
import { revealMysteryItems } from './payments/subscriptions';
import cleanupPinnedItems from '../../common/script/libs/cleanupPinnedItems';
const CRON_SAFE_MODE = nconf.get('CRON_SAFE_MODE') === 'true';
const CRON_SEMI_SAFE_MODE = nconf.get('CRON_SEMI_SAFE_MODE') === 'true';
@@ -499,6 +500,10 @@ export async function cron (options = {}) {
_.merge(progress, { down: 0, up: 0, collectedItems: 0 });
}
if (user.pinnedItems && user.pinnedItems.length > 0) {
user.pinnedItems = cleanupPinnedItems(user);
}
// Send notification for changes in HP and MP.
// First remove a possible previous cron notification because
// we don't want to flood the users with many cron notifications at once.