mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-12 16:52:52 +02:00
Disable polls in monoforums, enable in Saved Messages.
This commit is contained in:
parent
2a153214f6
commit
4c8ff1c7ec
3 changed files with 17 additions and 4 deletions
|
@ -156,6 +156,12 @@ bool CanSendAnyOf(
|
|||
}
|
||||
return false;
|
||||
} else if (const auto channel = peer->asChannel()) {
|
||||
if (channel->isMonoforum()) {
|
||||
rights &= ~ChatRestriction::SendPolls;
|
||||
if (!rights) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
using Flag = ChannelDataFlag;
|
||||
const auto allowed = channel->amIn()
|
||||
|| ((channel->flags() & Flag::HasLink)
|
||||
|
|
|
@ -663,10 +663,11 @@ bool PeerData::canPinMessages() const {
|
|||
|
||||
bool PeerData::canCreatePolls() const {
|
||||
if (const auto user = asUser()) {
|
||||
return user->isBot()
|
||||
&& !user->isSupport()
|
||||
&& !user->isRepliesChat()
|
||||
&& !user->isVerifyCodes();
|
||||
return user->isSelf()
|
||||
|| (user->isBot()
|
||||
&& !user->isSupport()
|
||||
&& !user->isRepliesChat()
|
||||
&& !user->isVerifyCodes());
|
||||
}
|
||||
return Data::CanSend(this, ChatRestriction::SendPolls);
|
||||
}
|
||||
|
|
|
@ -274,6 +274,12 @@ inline auto DefaultRestrictionValue(
|
|||
| Flag::Forbidden
|
||||
| Flag::Creator
|
||||
| Flag::Broadcast;
|
||||
if (channel->isMonoforum()) {
|
||||
rights &= ~ChatRestriction::SendPolls;
|
||||
if (!rights) {
|
||||
return rpl::single(false);
|
||||
}
|
||||
}
|
||||
return rpl::combine(
|
||||
PeerFlagsValue(channel, mask),
|
||||
AdminRightValue(
|
||||
|
|
Loading…
Add table
Reference in a new issue