Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

core: remove note's vault relation regardless of vault

Abdullah Atta77ee56dd148a
diff --git a/packages/core/src/api/vault.ts b/packages/core/src/api/vault.ts
index 55d433f3e..ea1c7e199 100644
--- a/packages/core/src/api/vault.ts
+++ b/packages/core/src/api/vault.ts
@@ -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();
}
/**