core: remove note's vault relation regardless of vault

This commit is contained in:
Abdullah Atta
2024-02-22 23:26:25 +05:00
parent c0e79cc65e
commit 8bfb617387

View File

@@ -180,9 +180,8 @@ export default class Vault {
async remove(noteId: string, password: string) {
await this.unlockNote(noteId, password, true);
const vault = await this.db.vaults.default();
if (!vault) await this.create(password);
else await this.db.relations.unlink(vault, { id: noteId, type: "note" });
if (!(await this.exists())) await this.create(password);
await this.db.relations.to({ id: noteId, type: "note" }, "vault").unlink();
}
/**