From 826a61d5ef009cac168599dc4e2b45ee8a45326d Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 26 Aug 2026 17:56:05 +0200 Subject: 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 Claude-Session: https://claude.ai/code/session_01P88Q3MCSCSQxKDy7pmXh9F --- tests/test_mainwindow.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/test_mainwindow.cpp') 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() -- cgit v1.2.3