2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Track and display unread count in discussions.

This commit is contained in:
John Preston
2021-08-30 18:37:09 +03:00
parent 85e4c8527b
commit c39024c7fd
12 changed files with 271 additions and 45 deletions

View File

@@ -2094,17 +2094,18 @@ void Updates::feedUpdate(const MTPUpdate &update) {
const auto msgId = d.vtop_msg_id().v;
const auto readTillId = d.vread_max_id().v;
const auto item = session().data().message(channelId, msgId);
const auto unreadCount = std::nullopt;
if (item) {
item->setRepliesInboxReadTill(readTillId);
item->setRepliesInboxReadTill(readTillId, unreadCount);
if (const auto post = item->lookupDiscussionPostOriginal()) {
post->setRepliesInboxReadTill(readTillId);
post->setRepliesInboxReadTill(readTillId, unreadCount);
}
}
if (const auto broadcastId = d.vbroadcast_id()) {
if (const auto post = session().data().message(
broadcastId->v,
d.vbroadcast_post()->v)) {
post->setRepliesInboxReadTill(readTillId);
post->setRepliesInboxReadTill(readTillId, unreadCount);
}
}
} break;