fix: read topics correctly

This commit is contained in:
AlexeyZavar 2024-04-19 03:37:47 +03:00
parent 1c275caf9d
commit f5470cd235
2 changed files with 12 additions and 8 deletions

View file

@ -250,7 +250,7 @@ void readReactions(base::weak_ptr<Data::Thread> weakThread) {
}
void MarkAsReadThread(not_null<Data::Thread*> thread) {
const auto readHistory = [&](not_null<History*> history)
const auto readHistoryNative = [&](not_null<History*> history)
{
history->owner().histories().readInbox(history);
};
@ -272,13 +272,13 @@ void MarkAsReadThread(not_null<Data::Thread*> 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);
}
}
}

View file

@ -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();
};