From b7f2a4e0f8858b1aa0d86755ebab6826306f3eff Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 24 Aug 2026 21:57:28 +0200 Subject: fix(drafts): index a saved draft so it appears without a sync Autosave writes the draft to the Maildir drafts folder and stops, while the Drafts view is a notmuch path: query, so a freshly saved draft was invisible until notmuch new ran. saveDraftNow() now emits draftSaved, and MainWindow connects it to a new NotmuchWorker::indexDraftFile() that indexes the one file the way moveMessages() does, with the previous revision removed so a rewrite leaves no ghost. The send path unlinks a draft that was indexed while being composed, so draftRemoved -> removeIndexedFile() drops its entry too. Measured: notmuch_database_index_file assigns NO tags (unlike notmuch new, which adds draft inbox unread), so no tag-stripping is needed and the draft cannot leak into a tag:inbox view. Item 158. --- src/composewindow.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/composewindow.h') diff --git a/src/composewindow.h b/src/composewindow.h index 918d4e3..caff011 100644 --- a/src/composewindow.h +++ b/src/composewindow.h @@ -168,6 +168,17 @@ signals: /// pointer before WA_DeleteOnClose destroys the window. void closed(ComposeWindow *window); + /// A draft was written to disk, so the window's owner can index it and it + /// appears in the Drafts view without a full sync (item 158). + /// + /// \p path is the file just written, absolute. \p previousPath is the file + /// the write replaced, empty on the first save of a new draft. + void draftSaved(const QString &path, const QString &previousPath); + + /// A draft file was unlinked (sent), so its index entry must go too. + /// \p path is the file that was removed, absolute. + void draftRemoved(const QString &path); + protected: /// The one place the registry is told, whichever route closes the window. void closeEvent(QCloseEvent *event) override; -- cgit v1.2.3