aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-26 17:56:05 +0200
committerDanilo M. <danix@danix.xyz>2026-08-26 17:56:05 +0200
commit826a61d5ef009cac168599dc4e2b45ee8a45326d (patch)
tree9620d0ee14d220ebf87cd106a7dcf323f3856833 /src
parent9ae43f94f5d822efe582e79b47b2f5407161a38b (diff)
downloadqtmaildir-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 'src')
-rw-r--r--src/mainwindow.cpp13
1 files changed, 12 insertions, 1 deletions
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,
// `<maildir>/<folder>`, 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;
}