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: don't generate headline title if title was set during note creation (#8266)
01zulfideb507859aac
diff --git a/packages/core/__tests__/notes.test.ts b/packages/core/__tests__/notes.test.tsindex 80c88f2a1..7a5fdc51d 100644--- a/packages/core/__tests__/notes.test.ts+++ b/packages/core/__tests__/notes.test.ts@@ -205,6 +205,20 @@ test("note title with headline format should keep generating headline title unti}));});+test("note title with headline format should not generate headline title if title was set during note creation", () =>+ noteTest({ title: "already set title" }).then(async ({ db, id }) => {+ await db.settings.setTitleFormat("$headline$");+ await db.notes.add({+ id,+ content: {+ type: TEST_NOTE.content.type,+ data: "<p>some note content</p>"+ }+ });+ const note = await db.notes.note(id);+ expect(note?.title).toBe("already set title");+ }));+test("note should get headline from first paragraph in content", () =>noteTest({...TEST_NOTE,diff --git a/packages/core/src/collections/notes.ts b/packages/core/src/collections/notes.tsindex f95be2dee..a63ba4e4a 100644--- a/packages/core/src/collections/notes.ts+++ b/packages/core/src/collections/notes.ts@@ -130,6 +130,7 @@ export class Notes implements ICollection {}if (!isUpdating || item.title === "") {+ item.isGeneratedTitle = !Boolean(item.title);item.title =item.title ||formatTitle(@@ -139,7 +140,6 @@ export class Notes implements ICollection {headlineTitle,this.totalNotes);- item.isGeneratedTitle = true;}const currentNoteTitleFields = await this.db