This commit is contained in:
WBHarry 2026-01-12 20:52:50 +01:00
parent 23a497bab8
commit 2e4d3de379
5 changed files with 90 additions and 44 deletions

View file

@ -45,6 +45,26 @@ export default class DHDomainCard extends BaseDataItem {
/* -------------------------------------------- */
/**@inheritdoc */
async _preUpdate(data, options, user) {
const allowed = await super._preUpdate(data, options, user);
if (allowed === false) return;
if (this.parent.parent?.type === 'character') {
if (
data.system?.inVault &&
!this.inVault &&
this.parent.parent.system.sidebarFavorites.find(x => x?.id === this.parent.id)
) {
this.parent.parent.update({
'system.sidebarFavorites': this.parent.parent.system.sidebarFavorites.filter(
x => x.id !== this.parent.id
)
});
}
}
}
/**@inheritdoc */
async _preCreate(data, options, user) {
const allowed = await super._preCreate(data, options, user);