diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-21 09:36:04 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-21 09:36:04 +0200 |
| commit | 9b1b371856c148dc668587254c51134ca9d4b605 (patch) | |
| tree | c2b6144af83ed2cb8f08b2c3ec76d28d3f98aa9d /src/messagedetailsdialog.cpp | |
| parent | 1dcf0a0329adfd61fcc547a976e00df412549024 (diff) | |
| download | qtmaildir-9b1b371856c148dc668587254c51134ca9d4b605.tar.gz qtmaildir-9b1b371856c148dc668587254c51134ca9d4b605.zip | |
feat(compose): save drafts atomically into a Maildir, item 123
DraftStore::write() renders a built message into <folder>/cur with the
given Maildir flags, writing through QSaveFile and unlinking the previous
revision only after the new file is in place.
Two orderings here are load-bearing and both are covered by a test that
was checked against the mutation that breaks it.
The unlink runs only after the write has succeeded, so a failed save
leaves the previous revision intact rather than losing both. Provoking
that failure needs care: the plan's version used an unwritable path where
mkpath() fails and the function returns before reaching either the write
or the unlink, so a mutation moving the unlink up survived it. The test
uses an existing but read-only cur/ instead, where the failure lands at
the write.
And the size comparison stays ahead of commit() in the condition, because
QSaveFile::commit() returns true after a short write and renames the
truncated bytes into place: measured, write 4096 of 65536 with commit
reporting true and the file left in the listing. What leaves the
directory empty is the short-circuit returning before commit() is
reached, after which ~QSaveFile() discards the uncommitted scratch file.
Reducing the condition to !file.commit() looks like a simplification and
writes a truncated draft into cur/, where notmuch would index it and
mbsync would upload it.
Resolving the mail root stays the caller's job, per item 124; this takes
an absolute folder path and composes nothing.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QP2g3b3kuLx6AYFCNEz6UR
Diffstat (limited to 'src/messagedetailsdialog.cpp')
0 files changed, 0 insertions, 0 deletions
