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

Allow editing messages in channels indefinitely.

This commit is contained in:
John Preston
2020-04-23 16:08:50 +04:00
parent 862e4e45ad
commit 3fa5e004fe
4 changed files with 21 additions and 16 deletions

View File

@@ -406,7 +406,8 @@ bool PeerData::canPinMessages() const {
if (const auto user = asUser()) {
return user->fullFlags() & MTPDuserFull::Flag::f_can_pin_message;
} else if (const auto chat = asChat()) {
return chat->amIn() && !chat->amRestricted(ChatRestriction::f_pin_messages);
return chat->amIn()
&& !chat->amRestricted(ChatRestriction::f_pin_messages);
} else if (const auto channel = asChannel()) {
return channel->isMegagroup()
? !channel->amRestricted(ChatRestriction::f_pin_messages)
@@ -416,6 +417,19 @@ bool PeerData::canPinMessages() const {
Unexpected("Peer type in PeerData::canPinMessages.");
}
bool PeerData::canEditMessagesIndefinitely() const {
if (const auto user = asUser()) {
return user->isSelf();
} else if (const auto chat = asChat()) {
return false;
} else if (const auto channel = asChannel()) {
return channel->isMegagroup()
? channel->canPinMessages()
: channel->canEditMessages();
}
Unexpected("Peer type in PeerData::canEditMessagesIndefinitely.");
}
void PeerData::setPinnedMessageId(MsgId messageId) {
const auto min = [&] {
if (const auto channel = asChannel()) {