mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-16 11:47:54 +01:00
core: don't generate headline title if title was set during note creation (#8266)
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user