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 note title can be set to empty
Abdullah Atta2293866c6196
diff --git a/packages/core/__tests__/notes.test.ts b/packages/core/__tests__/notes.test.tsindex bd2a8f8e8..f8c0a4bb8 100644--- a/packages/core/__tests__/notes.test.ts+++ b/packages/core/__tests__/notes.test.ts@@ -115,6 +115,13 @@ test("note without a title should get a premade title", () =>expect(note?.title.startsWith("Note ")).toBe(true);}));+test("setting note title to empty should set the default title", () =>+ noteTest({ title: "I am some title" }).then(async ({ db, id }) => {+ await db.notes.add({ id, title: "" });+ const note = await db.notes.note(id);+ expect(note?.title.startsWith("Note ")).toBe(true);+ }));+test("note should get headline from content", () =>noteTest({...TEST_NOTE,diff --git a/packages/core/src/collections/notes.ts b/packages/core/src/collections/notes.tsindex 8e84b75ba..06651ebd2 100644--- a/packages/core/src/collections/notes.ts+++ b/packages/core/src/collections/notes.ts@@ -107,7 +107,7 @@ export class Notes implements ICollection {if (item.title) {item.title = item.title.replace(NEWLINE_STRIP_REGEX, " ");dateEdited = Date.now();- } else if (!isUpdating) {+ } else {item.title = formatTitle(this.db.settings.getTitleFormat(),this.db.settings.getDateFormat(),