core: don't unlink vault notes on vault remove

This commit is contained in:
Abdullah Atta
2024-02-22 23:14:06 +05:00
parent 1c3694df9b
commit 854c2323e6
2 changed files with 3 additions and 3 deletions

View File

@@ -160,7 +160,7 @@ export default class Vault {
await this.db.notes.remove(...lockedIds);
}
await this.db.vaults.remove(vault.id);
await this.db.vaults.remove(vault.id, deleteAllLockedNotes);
this.password = undefined;
}

View File

@@ -55,9 +55,9 @@ export class Vaults implements ICollection {
return id;
}
async remove(id: string) {
async remove(id: string, unlinkAllNotes = false) {
await this.db.transaction(async () => {
await this.db.relations.unlinkOfType("vault", [id]);
if (unlinkAllNotes) await this.db.relations.unlinkOfType("vault", [id]);
await this.collection.softDelete([id]);
});
}