2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Allow pinned messages in channels.

This commit is contained in:
John Preston
2017-11-21 17:23:56 +04:00
parent b337d54623
commit 75d8d01b17
14 changed files with 240 additions and 145 deletions

View File

@@ -1076,9 +1076,10 @@ HistoryItem *History::createItem(const MTPMessage &msg, bool applyServiceAction,
} break;
case mtpc_messageActionPinMessage: {
if (m.has_reply_to_msg_id() && result && result->history()->peer->isMegagroup()) {
result->history()->peer->asChannel()->mgInfo->pinnedMsgId = m.vreply_to_msg_id.v;
Notify::peerUpdatedDelayed(result->history()->peer, Notify::PeerUpdate::Flag::ChannelPinnedChanged);
if (m.has_reply_to_msg_id() && result) {
if (auto channel = result->history()->peer->asChannel()) {
channel->setPinnedMessageId(m.vreply_to_msg_id.v);
}
}
} break;
@@ -2355,8 +2356,8 @@ void History::clear(bool leaveItems) {
lastKeyboardInited = false;
} else {
setUnreadCount(0);
if (peer->isMegagroup()) {
peer->asChannel()->mgInfo->pinnedMsgId = 0;
if (auto channel = peer->asChannel()) {
channel->clearPinnedMessage();
}
clearLastKeyboard();
}