aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mainwindow.cpp13
-rw-r--r--tests/test_mainwindow.cpp15
2 files changed, 27 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;
}
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()