mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-29 13:39:06 +00:00
Disable polls in monoforums, enable in Saved Messages.
This commit is contained in:
parent
2a153214f6
commit
4c8ff1c7ec
@ -156,6 +156,12 @@ bool CanSendAnyOf(
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} else if (const auto channel = peer->asChannel()) {
|
} else if (const auto channel = peer->asChannel()) {
|
||||||
|
if (channel->isMonoforum()) {
|
||||||
|
rights &= ~ChatRestriction::SendPolls;
|
||||||
|
if (!rights) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
using Flag = ChannelDataFlag;
|
using Flag = ChannelDataFlag;
|
||||||
const auto allowed = channel->amIn()
|
const auto allowed = channel->amIn()
|
||||||
|| ((channel->flags() & Flag::HasLink)
|
|| ((channel->flags() & Flag::HasLink)
|
||||||
|
@ -663,10 +663,11 @@ bool PeerData::canPinMessages() const {
|
|||||||
|
|
||||||
bool PeerData::canCreatePolls() const {
|
bool PeerData::canCreatePolls() const {
|
||||||
if (const auto user = asUser()) {
|
if (const auto user = asUser()) {
|
||||||
return user->isBot()
|
return user->isSelf()
|
||||||
&& !user->isSupport()
|
|| (user->isBot()
|
||||||
&& !user->isRepliesChat()
|
&& !user->isSupport()
|
||||||
&& !user->isVerifyCodes();
|
&& !user->isRepliesChat()
|
||||||
|
&& !user->isVerifyCodes());
|
||||||
}
|
}
|
||||||
return Data::CanSend(this, ChatRestriction::SendPolls);
|
return Data::CanSend(this, ChatRestriction::SendPolls);
|
||||||
}
|
}
|
||||||
|
@ -274,6 +274,12 @@ inline auto DefaultRestrictionValue(
|
|||||||
| Flag::Forbidden
|
| Flag::Forbidden
|
||||||
| Flag::Creator
|
| Flag::Creator
|
||||||
| Flag::Broadcast;
|
| Flag::Broadcast;
|
||||||
|
if (channel->isMonoforum()) {
|
||||||
|
rights &= ~ChatRestriction::SendPolls;
|
||||||
|
if (!rights) {
|
||||||
|
return rpl::single(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
return rpl::combine(
|
return rpl::combine(
|
||||||
PeerFlagsValue(channel, mask),
|
PeerFlagsValue(channel, mask),
|
||||||
AdminRightValue(
|
AdminRightValue(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user