From aa5fc733c768f8779af897c0cdcaf836b2afcefb Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sat, 31 Oct 2026 12:21:39 +0100 Subject: Revert "fix: credit a tag confirmation to the command whose tags it names" This reverts commit a30b4c2. A backfill will stop arming commands on the shared confirmation queue altogether, so matching confirmations by tags is no longer needed, and its drop-ahead rule could discard a live command when an unarmed write's tags matched a later one. Co-Authored-By: Claude Opus 5.5 --- src/mainwindow.cpp | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 9b1b874..8b1c537 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -2889,23 +2889,6 @@ void MainWindow::applyRuleToExistingMail(const TagRule &rule) Q_ARG(quint64, m_pendingApplyGeneration)); } -QList MainWindow::armTagCommandsForTesting( - const QList> &ops) -{ - QList commands; - m_undoStack.beginMacro(QStringLiteral("test")); - for (int i = 0; i < ops.size(); ++i) { - auto *command = new MessageTagCommand(this, {}, ops.at(i).first, - ops.at(i).second, - QStringLiteral("test")); - awaitTagConfirmation(command, i == 0); - m_undoStack.push(command); - commands.append(command); - } - m_undoStack.endMacro(); - return commands; -} - void MainWindow::confirmRuleApply(const QVector &counts) { const TagRule rule = m_pendingApplyRule; @@ -5322,18 +5305,9 @@ void MainWindow::onTagsApplied(const TagChange &change) // instead turned the undo of "mark 44 read" into "mark 44 unread": 2 // unread became 43, on real mail, and maildir.synchronize_flags carried it // into the filenames. - // - // Matched on the tags, and the commands ahead of the match dropped: they - // were writes the worker found nothing to do for, and crediting them this - // write's ids would make their undo invert the wrong tag on the wrong - // messages. See awaitTagConfirmation(). - for (int i = 0; i < m_awaitingTagConfirmation.size(); ++i) { - TagCommand *command = m_awaitingTagConfirmation.at(i); - if (command->confirmedBy(change)) { - m_awaitingTagConfirmation.remove(0, i + 1); - command->addChangedMessageIds(change.messageIds); - break; - } + if (!m_awaitingTagConfirmation.isEmpty()) { + TagCommand *command = m_awaitingTagConfirmation.takeFirst(); + command->addChangedMessageIds(change.messageIds); } // Recorded here, where a write is CONFIRMED, rather than where one is sent: -- cgit v1.2.3