mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
fix: read topics correctly
This commit is contained in:
parent
1c275caf9d
commit
f5470cd235
2 changed files with 12 additions and 8 deletions
|
@ -250,7 +250,7 @@ void readReactions(base::weak_ptr<Data::Thread> weakThread) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkAsReadThread(not_null<Data::Thread*> thread) {
|
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);
|
history->owner().histories().readInbox(history);
|
||||||
};
|
};
|
||||||
|
@ -272,13 +272,13 @@ void MarkAsReadThread(not_null<Data::Thread*> thread) {
|
||||||
{
|
{
|
||||||
MarkAsReadThread(topic);
|
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()) {
|
} else if (const auto topic = thread->asTopic()) {
|
||||||
topic->readTillEnd();
|
topic->readTillEnd();
|
||||||
|
} else if (const auto history = thread->asHistory()) {
|
||||||
|
readHistoryNative(history);
|
||||||
|
if (const auto migrated = history->migrateSibling()) {
|
||||||
|
readHistoryNative(migrated);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -823,10 +823,14 @@ void MainMenu::setupMenu() {
|
||||||
auto prev = settings->sendReadMessages;
|
auto prev = settings->sendReadMessages;
|
||||||
settings->set_sendReadMessages(true);
|
settings->set_sendReadMessages(true);
|
||||||
|
|
||||||
auto chats = _controller->session().data().chatsList();
|
auto chats = controller->session().data().chatsList();
|
||||||
MarkAsReadChatList(chats);
|
MarkAsReadChatList(chats);
|
||||||
|
|
||||||
settings->set_sendReadMessages(prev);
|
// slight delay for forums to send packets
|
||||||
|
dispatchToMainThread([=]
|
||||||
|
{
|
||||||
|
settings->set_sendReadMessages(prev);
|
||||||
|
}, 200);
|
||||||
close();
|
close();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue