mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-01 19:49:54 +02:00
core: always delete vault references on vault deletion
This commit is contained in:
@@ -185,7 +185,7 @@ test("delete vault without deleting all locked notes", () =>
|
||||
|
||||
await db.vault.delete();
|
||||
|
||||
expect(await db.relations.from(vault, "note").has(id)).toBe(true);
|
||||
expect(await db.relations.from(vault, "note").has(id)).toBe(false);
|
||||
expect(await db.vaults.default()).toBeUndefined();
|
||||
}));
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ export default class Vault {
|
||||
await this.db.notes.remove(...lockedIds);
|
||||
}
|
||||
|
||||
await this.db.vaults.remove(vault.id, deleteAllLockedNotes);
|
||||
await this.db.vaults.remove(vault.id);
|
||||
this.password = undefined;
|
||||
}
|
||||
|
||||
|
||||
@@ -138,7 +138,6 @@ export class Notes implements ICollection {
|
||||
headline: headline,
|
||||
|
||||
pinned: item.pinned,
|
||||
locked: item.locked,
|
||||
favorite: item.favorite,
|
||||
localOnly: item.localOnly,
|
||||
conflicted: item.conflicted,
|
||||
|
||||
@@ -55,9 +55,9 @@ export class Vaults implements ICollection {
|
||||
return id;
|
||||
}
|
||||
|
||||
async remove(id: string, unlinkAllNotes = false) {
|
||||
async remove(id: string) {
|
||||
await this.db.transaction(async () => {
|
||||
if (unlinkAllNotes) await this.db.relations.unlinkOfType("vault", [id]);
|
||||
await this.db.relations.unlinkOfType("vault", [id]);
|
||||
await this.collection.softDelete([id]);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ export class NNMigrationProvider implements MigrationProvider {
|
||||
.addColumn("headline", "text")
|
||||
.addColumn("contentId", "text")
|
||||
.addColumn("pinned", "boolean")
|
||||
.addColumn("locked", "boolean")
|
||||
.addColumn("favorite", "boolean")
|
||||
.addColumn("localOnly", "boolean")
|
||||
.addColumn("conflicted", "boolean")
|
||||
|
||||
Reference in New Issue
Block a user