mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-05 09:05:14 +00:00
Update API scheme on layer 148.
Extract message history corner buttons code.
This commit is contained in:
@@ -700,6 +700,18 @@ not_null<HistoryItem*> History::addNewLocalMessage(
|
||||
}
|
||||
|
||||
void History::clearUnreadMentionsFor(MsgId topicRootId) {
|
||||
const auto forum = peer->forum();
|
||||
if (!topicRootId) {
|
||||
if (forum) {
|
||||
forum->clearAllUnreadMentions();
|
||||
}
|
||||
unreadMentions().clear();
|
||||
return;
|
||||
} else if (forum) {
|
||||
if (const auto topic = forum->topicFor(topicRootId)) {
|
||||
topic->unreadMentions().clear();
|
||||
}
|
||||
}
|
||||
const auto &ids = unreadMentionsIds();
|
||||
if (ids.empty()) {
|
||||
return;
|
||||
@@ -720,6 +732,39 @@ void History::clearUnreadMentionsFor(MsgId topicRootId) {
|
||||
}
|
||||
}
|
||||
|
||||
void History::clearUnreadReactionsFor(MsgId topicRootId) {
|
||||
const auto forum = peer->forum();
|
||||
if (!topicRootId) {
|
||||
if (forum) {
|
||||
forum->clearAllUnreadReactions();
|
||||
}
|
||||
unreadReactions().clear();
|
||||
return;
|
||||
} else if (forum) {
|
||||
if (const auto topic = forum->topicFor(topicRootId)) {
|
||||
topic->unreadReactions().clear();
|
||||
}
|
||||
}
|
||||
const auto &ids = unreadReactionsIds();
|
||||
if (ids.empty()) {
|
||||
return;
|
||||
}
|
||||
const auto owner = &this->owner();
|
||||
const auto peerId = peer->id;
|
||||
auto items = base::flat_set<MsgId>();
|
||||
items.reserve(ids.size());
|
||||
for (const auto &id : ids) {
|
||||
if (const auto item = owner->message(peerId, id)) {
|
||||
if (item->topicRootId() == topicRootId) {
|
||||
items.emplace(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const auto &id : items) {
|
||||
unreadReactions().erase(id);
|
||||
}
|
||||
}
|
||||
|
||||
not_null<HistoryItem*> History::addNewToBack(
|
||||
not_null<HistoryItem*> item,
|
||||
bool unread) {
|
||||
|
Reference in New Issue
Block a user