A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
core: fix content not marked unsynced when toggling local only (#10523)
Abdullah Attaeabe438d845b
diff --git a/packages/core/__tests__/notes.test.ts b/packages/core/__tests__/notes.test.tsindex 34edfa76f..cd704fbc6 100644--- a/packages/core/__tests__/notes.test.ts+++ b/packages/core/__tests__/notes.test.ts@@ -496,6 +496,28 @@ test("note's content should follow note's localOnly property", () =>expect(content?.localOnly).toBe(false);}));+test("toggling localOnly should mark the note's content as unsynced", () =>+ noteTest().then(async ({ db, id }) => {+ const note = await db.notes.note(id);+ const markSynced = () =>+ db+ .sql()+ .updateTable("content")+ .set({ synced: true })+ .where("id", "=", note.contentId!)+ .execute();+ const isSynced = async () =>+ (await db.content.get(note.contentId!))?.synced;++ await markSynced();+ await db.notes.localOnly(true, id);+ expect(await isSynced()).toBe(false);++ await markSynced();+ await db.notes.localOnly(false, id);+ expect(await isSynced()).toBe(false);+ }));+test("grouping items where item.title is empty or undefined shouldn't throw", () => {expect(// eslint-disable-next-line @typescript-eslint/ban-ts-commentdiff --git a/packages/core/src/collections/content.ts b/packages/core/src/collections/content.tsindex 30fd8357f..caa99e215 100644--- a/packages/core/src/collections/content.ts+++ b/packages/core/src/collections/content.ts@@ -222,7 +222,8 @@ export class Content implements ICollection {.where("noteId", "in", ids).set({...partial,- dateModified: Date.now()+ dateModified: Date.now(),+ synced: false}).execute();