Skip to content

new-note-namer: fix rename prompt firing on existing notes (#300) - #301

Closed
luginf wants to merge 3 commits into
qownnotes:mainfrom
luginf:new-note-namer
Closed

luginf wants to merge 3 commits into
qownnotes:mainfrom
luginf:new-note-namer

Conversation

@luginf

@luginf luginf commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #300.

handleNoteTextFileNameHook used note.fileCreated == "Invalid Date" to detect a brand-new note. That signal actually marks "first DB row for this note", not "new file on disk" — it also reads "Invalid Date" the first time a pre-existing, not-yet-indexed note file is edited and saved (e.g. right after pointing QOwnNotes at a folder with existing .md files). That made the script wrongly prompt for a file name on existing notes, as reported in #300.

Fix

  • Replaced the fileCreated check with a one-shot _isNewNote flag, set only in handleNewNoteHeadlineHook (which fires exclusively for genuine new-note creation, immediately before handleNoteTextFileNameHook per the documented hook order) and consumed right after use.
  • Bumped to 0.0.5 and added a CHANGELOG.md entry.

Test plan

  • just test (info.json/CHANGELOG version check passes for new-note-namer)
  • Manual: open an existing note in a freshly added note folder, edit it, let it autosave — no rename dialog should appear.
  • Manual: create a new note (search term and menu flows) — rename/title dialogs still behave as before.

luginf and others added 3 commits September 28, 2026 07:53
Squash fork history: main was diverged from upstream only by these
config files (plus a file-mode fix), so this replaces the tangled
merge history with a single commit on top of upstream/main.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The "metadata-index" GitHub Release this workflow uploads to only
exists on qownnotes/scripts; forks don't inherit Releases via git,
so every push to main here failed with "release not found".

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…#300)

note.fileCreated == "Invalid Date" was used to detect a brand-new
note, but it also reads "Invalid Date" the first time a pre-existing,
not-yet-indexed note file is edited and saved -- it marks "new DB
row", not "new file on disk". This made the script wrongly prompt for
a file name on existing notes.

Replace it with a one-shot flag set in handleNewNoteHeadlineHook,
which only fires for genuine new-note creation, immediately before
handleNoteTextFileNameHook.

Bump to 0.0.5 and update CLAUDE.md's documented (and now disproven)
assumption about fileCreated.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@pbek

pbek commented Sep 28, 2026

Copy link
Copy Markdown
Member

This PR changes more than just the script! Please create separate PRs to discuss the changes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] New note namer runs on existing notes

2 participants