update migration code to remove invalid dialogs

This commit is contained in:
Dev 2024-11-02 22:17:59 +00:00
parent 0411430381
commit 78eb759e77

View File

@ -241,15 +241,13 @@ export class GameController {
this.logger.warning(`Migration: Moved Hideout Improvement data to new property 'Improvements'`); this.logger.warning(`Migration: Moved Hideout Improvement data to new property 'Improvements'`);
} }
//Remove spt friend / commando from dialogues as they need to be remade using mongo_ids // Remove invalid dialogs (MUST be a valid mongo id)
const commando = fullProfile.dialogues.sptCommando; // 100% removes commando + spyFriend
if (commando) { for (const dialogKey in fullProfile.dialogues) {
delete fullProfile.dialogues.sptCommando; const isValidKey = this.hashUtil.isValidMongoId(dialogKey);
if (!isValidKey) {
delete fullProfile.dialogues[dialogKey];
} }
const sptFriend = fullProfile.dialogues.friend;
if (sptFriend) {
delete fullProfile.dialogues.sptFriend;
} }
} }