diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-26 17:56:05 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-26 17:56:05 +0200 |
| commit | 826a61d5ef009cac168599dc4e2b45ee8a45326d (patch) | |
| tree | 9620d0ee14d220ebf87cd106a7dcf323f3856833 /tests/test_mainwindow.cpp | |
| parent | 9ae43f94f5d822efe582e79b47b2f5407161a38b (diff) | |
| download | qtmaildir-826a61d5ef009cac168599dc4e2b45ee8a45326d.tar.gz qtmaildir-826a61d5ef009cac168599dc4e2b45ee8a45326d.zip | |
fix: give a restored message its inbox tag back
Restore moved the file back to the inbox folder and left it invisible: the
message carried no `inbox` tag, so the Inbox view could not see it, and the
user reported restoring a message and losing it.
Delete strips `inbox` so a deleted message leaves that view, which makes
restoring it the other half of the same change. restoreResolvedMessages()
already meant to add the tag back, and the comment above the branch
describes exactly this failure, but the comparison deciding it read
`origin`, which four lines earlier had been reassigned from the bare folder
name to the finished tag. `deleted-from:Inbox` never equals `Inbox` however
an account spells its inbox, so the branch was dead and the tag never came
back.
The destination folder is taken from the move's own key instead, which is
what the surrounding code already builds and what the comment says is being
compared.
The existing test passed against this throughout. It asserted the file
moved, the origin tag came off and `deleted` came off, all of which were
true; nothing asserted the tag that decides whether the user can see the
message afterwards. It does now, and fails against the old comparison.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P88Q3MCSCSQxKDy7pmXh9F
Diffstat (limited to 'tests/test_mainwindow.cpp')
| -rw-r--r-- | tests/test_mainwindow.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_mainwindow.cpp b/tests/test_mainwindow.cpp index 887fead..5d2316f 100644 --- a/tests/test_mainwindow.cpp +++ b/tests/test_mainwindow.cpp @@ -11854,6 +11854,21 @@ void TestMainWindow::restoreReturnsAMessageToItsOriginFolder() QCOMPARE(notmuchCount(cfg, QStringLiteral("id:ro1@example.org")), 1); QVERIFY(!folderHasMessageFile(root + QStringLiteral("/acct/Trash/cur"), stem)); + + // And the `inbox` TAG came back with it. Delete strips that tag so the + // message leaves the Inbox view, which makes restoring it the other half + // of the same change: without it the message sits in the inbox FOLDER + // carrying no `inbox` tag and the Inbox view cannot see it, which reads as + // "I restored it and it is gone". + // + // The file assertions above all passed while this was broken: the folder + // comparison that decides it was made against the finished TAG rather than + // against the destination folder, so it was always false. Nothing else + // here would have noticed. + QTRY_VERIFY_WITH_TIMEOUT( + notmuchCount(cfg, QStringLiteral("id:ro1@example.org and tag:inbox")) + == 1, + 15000); } void TestMainWindow::restoreFallsBackToInboxWithoutAnOriginTag() |
