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

Support separate message type group restrictions.

This commit is contained in:
John Preston
2023-01-10 22:56:20 +04:00
parent de5bbf2cb9
commit 554f66f089
64 changed files with 1437 additions and 832 deletions

View File

@@ -951,7 +951,11 @@ void Filler::addManageChat() {
}
void Filler::addCreatePoll() {
if (!(_topic ? _topic->canSendPolls() : _peer->canSendPolls())) {
constexpr auto kRight = ChatRestriction::SendPolls;
const auto can = _topic
? Data::CanSend(_topic, kRight)
: Data::CanSend(_peer, kRight);
if (!can) {
return;
}
const auto peer = _peer;
@@ -1329,7 +1333,7 @@ void PeerMenuShareContactBox(
const auto weak = std::make_shared<QPointer<Ui::BoxContent>>();
auto callback = [=](not_null<Data::Thread*> thread) {
const auto peer = thread->peer();
if (!thread->canWrite()) {
if (!Data::CanSend(thread, ChatRestriction::SendOther)) {
navigation->parentController()->show(
Ui::MakeInformBox(tr::lng_forward_share_cant()),
Ui::LayerOption::KeepOther);
@@ -1946,10 +1950,9 @@ QPointer<Ui::BoxContent> ShowShareGameBox(
Ui::LayerOption::KeepOther);
};
auto filter = [](not_null<Data::Thread*> thread) {
const auto peer = thread->peer();
return (thread->canWrite() || thread->asForum())
&& !peer->amRestricted(ChatRestriction::SendGames)
&& !peer->isSelf();
return !thread->peer()->isSelf()
&& (Data::CanSend(thread, ChatRestriction::SendGames)
|| thread->asForum());
};
auto initBox = [](not_null<PeerListBox*> box) {
box->addButton(tr::lng_cancel(), [box] {