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 --- src/mainwindow.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index a09a572..c62013d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -5883,13 +5883,24 @@ void MainWindow::restoreResolvedMessages(const QStringList &messageIds, // `/`, and the account is resolved back from it // rather than captured above, where it belongs to the per-message loop // and is out of scope here. + // + // The destination FOLDER, taken from the key rather than from + // `origin` above: that is the finished TAG, `deleted-from:Inbox`, + // which never equals `Inbox` however the account spells it. The + // comparison was therefore always false and the `inbox` tag never came + // back, so a restored message sat in the inbox folder invisible to the + // Inbox view until the next hook run. The comment above says what this + // does; for one release the code did not do it. QStringList add; const QString destMaildir = it.key().section(QLatin1Char('/'), 0, 0); + const QString destFolder = it.key().section(QLatin1Char('/'), 1); for (const Account &candidate : m_config.accounts()) { if (candidate.maildir != destMaildir) continue; - if (origin.compare(candidate.inboxFolder(), Qt::CaseInsensitive) == 0) + if (destFolder.compare(candidate.inboxFolder(), + Qt::CaseInsensitive) == 0) { add.append(QStringLiteral("inbox")); + } break; } -- cgit v1.2.3