From f5470cd23599377fe8a565cd444b7138896d78cf Mon Sep 17 00:00:00 2001 From: AlexeyZavar Date: Fri, 19 Apr 2024 03:37:47 +0300 Subject: [PATCH] fix: read topics correctly --- Telegram/SourceFiles/ayu/utils/telegram_helpers.cpp | 12 ++++++------ Telegram/SourceFiles/window/window_main_menu.cpp | 8 ++++++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Telegram/SourceFiles/ayu/utils/telegram_helpers.cpp b/Telegram/SourceFiles/ayu/utils/telegram_helpers.cpp index 2169aad9a..8a6969367 100644 --- a/Telegram/SourceFiles/ayu/utils/telegram_helpers.cpp +++ b/Telegram/SourceFiles/ayu/utils/telegram_helpers.cpp @@ -250,7 +250,7 @@ void readReactions(base::weak_ptr weakThread) { } void MarkAsReadThread(not_null thread) { - const auto readHistory = [&](not_null history) + const auto readHistoryNative = [&](not_null history) { history->owner().histories().readInbox(history); }; @@ -272,13 +272,13 @@ void MarkAsReadThread(not_null thread) { { MarkAsReadThread(topic); }); - } else if (const auto history = thread->asHistory()) { - readHistory(history); - if (const auto migrated = history->migrateSibling()) { - readHistory(migrated); - } } else if (const auto topic = thread->asTopic()) { topic->readTillEnd(); + } else if (const auto history = thread->asHistory()) { + readHistoryNative(history); + if (const auto migrated = history->migrateSibling()) { + readHistoryNative(migrated); + } } } diff --git a/Telegram/SourceFiles/window/window_main_menu.cpp b/Telegram/SourceFiles/window/window_main_menu.cpp index e70a224b2..2909f97bd 100644 --- a/Telegram/SourceFiles/window/window_main_menu.cpp +++ b/Telegram/SourceFiles/window/window_main_menu.cpp @@ -823,10 +823,14 @@ void MainMenu::setupMenu() { auto prev = settings->sendReadMessages; settings->set_sendReadMessages(true); - auto chats = _controller->session().data().chatsList(); + auto chats = controller->session().data().chatsList(); MarkAsReadChatList(chats); - settings->set_sendReadMessages(prev); + // slight delay for forums to send packets + dispatchToMainThread([=] + { + settings->set_sendReadMessages(prev); + }, 200); close(); };