diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-24 21:57:28 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-24 21:57:28 +0200 |
| commit | b7f2a4e0f8858b1aa0d86755ebab6826306f3eff (patch) | |
| tree | 542934c034716b69b15258bf06e491798408af84 /src/notmuchworker.h | |
| parent | f6ceeacad8e1fe15c30db66dcfde8efa9dfb4758 (diff) | |
| download | qtmaildir-b7f2a4e0f8858b1aa0d86755ebab6826306f3eff.tar.gz qtmaildir-b7f2a4e0f8858b1aa0d86755ebab6826306f3eff.zip | |
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.
Diffstat (limited to 'src/notmuchworker.h')
| -rw-r--r-- | src/notmuchworker.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/notmuchworker.h b/src/notmuchworker.h index 8ed878f..3ccf8e5 100644 --- a/src/notmuchworker.h +++ b/src/notmuchworker.h @@ -134,6 +134,28 @@ public slots: /// it, so removing before indexing loses the message's tags. void moveMessages(const QStringList &messageIds, const QString &destFolder); + /// Indexes one freshly written file, so it appears in a `path:` query + /// without a full `notmuch new` (item 158). + /// + /// The draft-save path writes the file and stops, and the Drafts view is a + /// path query, so an unindexed draft is invisible until the next sync. A + /// draft rewrite writes a NEW file (MessageBuilder generates a fresh + /// Message-ID on every build) and unlinks the old, so \p previousPath is + /// removed after the new one is indexed, mirroring moveMessages()'s + /// ordering: the old entry must not linger as a ghost draft. + /// + /// \p path is absolute, as DraftStore::write() returns it. The Maildir + /// flags on the file (the "D" flag a draft carries) drive its tags exactly + /// as they would on a later `notmuch new`. + void indexDraftFile(const QString &path, const QString &previousPath = {}); + + /// Removes one file from the index, without touching the file on disk. + /// + /// The counterpart to indexDraftFile() for the send path: a draft that was + /// indexed while being composed is unlinked when it is sent, and its entry + /// must not linger as a ghost draft until the next sync. + void removeIndexedFile(const QString &path); + /// Batch tagging over whole threads. The UI holds thread ids, not message /// ids, for rows it has not opened, so the resolution happens here where /// the database handle lives. This is the path the archive/flag/delete |
