2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 22:55:11 +00:00

Support pinned topics in forums.

This commit is contained in:
John Preston
2022-10-19 12:19:11 +04:00
parent 306179ca7c
commit adaa1d0c55
7 changed files with 86 additions and 41 deletions

View File

@@ -34,6 +34,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_drafts.h"
#include "data/data_histories.h"
#include "data/data_folder.h"
#include "data/data_forum.h"
#include "data/data_scheduled_messages.h"
#include "data/data_send_action.h"
#include "data/data_message_reactions.h"
@@ -2289,6 +2290,23 @@ void Updates::feedUpdate(const MTPUpdate &update) {
}
} break;
case mtpc_updateChannelPinnedTopic: {
const auto &d = update.c_updateChannelPinnedTopic();
const auto peerId = peerFromChannel(d.vchannel_id());
if (const auto peer = session().data().peerLoaded(peerId)) {
const auto rootId = d.vtopic_id().value_or_empty();
if (const auto topic = peer->forumTopicFor(rootId)) {
session().data().setChatPinned(topic, 0, true);
} else if (const auto forum = peer->forum()) {
if (rootId) {
forum->requestTopic(rootId);
} else {
forum->unpinTopic();
}
}
}
} break;
// Pinned message.
case mtpc_updatePinnedMessages: {
const auto &d = update.c_updatePinnedMessages();