From edbf393cb79d20764fd224d32a195f59d19ef743 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Thu, 27 Aug 2026 11:51:06 +0200 Subject: fix: flag a saved draft seen so it is not tagged unread DraftStore::write() was called with "D", and it uses the flag string verbatim, so every draft this application wrote landed as :2,D. With maildir.synchronize_flags on, notmuch tags any message lacking the S flag `unread`, and a draft the user authored is seen by definition. The symptom heals itself: the next sync of that folder round-trips the file, adds S, and the tag goes away. Only the newest draft in a folder that has not synced since shows it, which is why it read as intermittent and why measuring an older draft finds nothing wrong. TestComposeWindow::aSavedDraftIsFlaggedSeen() asserts both flags on the written filename, verified failing first against "D". TestMainWindow::anAutosaveWritesADraftAndClearsTheDirtyFlag() asserted endsWith(":2,D"), pinning the whole flag set where its own comment said the point was the draft flag "not left bare", so it failed against the corrected behaviour. It checks for D within the flag set now. Also reconciles the backlog with the user's notes: records the forwarded-HTML defect as item 171, closes item 169 (shipped last session, its row still read open and its section was still in the open file), and records this fix as item 172. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01AtUzfNjMD8fiYfamDd3ywW --- tests/test_mainwindow.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'tests/test_mainwindow.cpp') diff --git a/tests/test_mainwindow.cpp b/tests/test_mainwindow.cpp index a572fd0..2fbdb20 100644 --- a/tests/test_mainwindow.cpp +++ b/tests/test_mainwindow.cpp @@ -13753,8 +13753,12 @@ void TestMainWindow::anAutosaveWritesADraftAndClearsTheDirtyFlag() QVERIFY(written.open(QIODevice::ReadOnly)); const QByteArray bytes = written.readAll(); QVERIFY2(bytes.contains("Draft body."), "the draft does not carry the body"); - // Written with the Maildir draft flag, not left bare. - QVERIFY2(files.first().endsWith(QStringLiteral(":2,D")), + // Written with the Maildir draft flag, not left bare. The flag SET is not + // pinned here: a draft also carries S, asserted by + // TestComposeWindow::aSavedDraftIsFlaggedSeen(), and an endsWith(":2,D") + // here would fail against that correct behaviour. + QVERIFY2(files.first().section(QStringLiteral(":2,"), 1) + .contains(QLatin1Char('D')), qPrintable(QStringLiteral("wrong maildir flags: ") + files.first())); } -- cgit v1.2.3