Fixing UI for 2.1 data changes

This commit is contained in:
Thaum Rystra
2024-03-23 16:02:28 +02:00
parent 293deaa592
commit 359d645f6b
40 changed files with 2142 additions and 510 deletions

View File

@@ -21,14 +21,8 @@ export default function verifyArchiveSafety({ meta, creature, properties, experi
}
});
properties.forEach(prop => {
if (meta.schemaVersion.schemaVersion >= 3) {
if (prop.root?.id !== creatureId) {
throw new Meteor.Error('Malicious prop', 'Properties contains an entry for the wrong creature');
}
} else {
if (prop.ancestors?.[0]?.id !== creatureId) {
throw new Meteor.Error('Malicious prop', 'Properties contains an entry for the wrong creature');
}
if (prop.root?.id !== creatureId) {
throw new Meteor.Error('Malicious prop', 'Properties contains an entry for the wrong creature');
}
});
}

View File

@@ -10,10 +10,11 @@ import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
// TODO make this a union type of all CreatureProperty types
const CreatureProperties: Mongo.Collection<any> = new Mongo.Collection('creatureProperties');
export interface CreatureProperty {
export interface CreatureProperty extends TreeDoc {
_id: string
_migrationError?: string
tags: string[]
type: string
disabled?: boolean
icon?: {
name: string