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

Support unread reactions in monoforums.

This commit is contained in:
John Preston
2025-05-30 21:10:18 +04:00
parent 6068678fa1
commit ffe6786ad1
11 changed files with 61 additions and 22 deletions

View File

@@ -836,11 +836,19 @@ void History::clearUnreadMentionsFor(MsgId topicRootId) {
}
}
void History::clearUnreadReactionsFor(MsgId topicRootId) {
void History::clearUnreadReactionsFor(
MsgId topicRootId,
Data::SavedSublist *sublist) {
const auto forum = peer->forum();
if (!topicRootId) {
const auto monoforum = peer->monoforum();
const auto sublistPeerId = sublist ? sublist->sublistPeer()->id : 0;
if ((!topicRootId && !sublist)
|| (!topicRootId && forum)
|| (!sublist && monoforum)) {
if (forum) {
forum->clearAllUnreadReactions();
} else if (monoforum) {
monoforum->clearAllUnreadReactions();
}
unreadReactions().clear();
return;
@@ -848,6 +856,8 @@ void History::clearUnreadReactionsFor(MsgId topicRootId) {
if (const auto topic = forum->topicFor(topicRootId)) {
topic->unreadReactions().clear();
}
} else if (monoforum) {
sublist->unreadReactions().clear();
}
const auto &ids = unreadReactionsIds();
if (ids.empty()) {
@@ -859,7 +869,8 @@ void History::clearUnreadReactionsFor(MsgId topicRootId) {
items.reserve(ids.size());
for (const auto &id : ids) {
if (const auto item = owner->message(peerId, id)) {
if (item->topicRootId() == topicRootId) {
if ((topicRootId && item->topicRootId() == topicRootId)
|| (sublist && item->sublistPeerId() == sublistPeerId)) {
items.emplace(id);
}
}