From 950659b29ded483127326891f62d513d1fc863c8 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 2 Jul 2025 10:57:14 +0400 Subject: [PATCH] Fix aggregate checklists updates. --- Telegram/SourceFiles/api/api_todo_lists.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/api/api_todo_lists.cpp b/Telegram/SourceFiles/api/api_todo_lists.cpp index af45543d52..c65001f671 100644 --- a/Telegram/SourceFiles/api/api_todo_lists.cpp +++ b/Telegram/SourceFiles/api/api_todo_lists.cpp @@ -182,11 +182,15 @@ void TodoLists::add( void TodoLists::toggleCompletion(FullMsgId itemId, int id, bool completed) { auto &entry = _toggles[itemId]; if (completed) { - if (!entry.completed.emplace(id).second) { + const auto changed1 = entry.completed.emplace(id).second; + const auto changed2 = entry.incompleted.remove(id); + if (!changed1 && !changed2) { return; } } else { - if (!entry.incompleted.emplace(id).second) { + const auto changed1 = entry.incompleted.emplace(id).second; + const auto changed2 = entry.completed.remove(id); + if (!changed1 && !changed2) { return; } }