mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fixed crash on restricting users from moderation box.
This commit is contained in:
parent
129d356909
commit
a866ba8cdd
1 changed files with 25 additions and 17 deletions
|
@ -678,24 +678,32 @@ void CreateModerateMessagesBox(
|
||||||
Ui::AddSkip(container);
|
Ui::AddSkip(container);
|
||||||
container->add(std::move(checkboxes));
|
container->add(std::move(checkboxes));
|
||||||
|
|
||||||
handleConfirmation(ban, controller, [=](
|
// Handle confirmation manually.
|
||||||
not_null<PeerData*> peer,
|
confirms->events() | rpl::start_with_next([=] {
|
||||||
not_null<ChannelData*> channel) {
|
if (ban->checked() && controller->collectRequests) {
|
||||||
if (wrap->toggled()) {
|
const auto kick = !wrap->toggled();
|
||||||
Api::ChatParticipants::Restrict(
|
const auto restrictions = getRestrictions();
|
||||||
channel,
|
const auto request = [=](
|
||||||
peer,
|
not_null<PeerData*> peer,
|
||||||
ChatRestrictionsInfo(), // Unused.
|
not_null<ChannelData*> channel) {
|
||||||
ChatRestrictionsInfo(getRestrictions(), 0),
|
if (!kick) {
|
||||||
nullptr,
|
Api::ChatParticipants::Restrict(
|
||||||
nullptr);
|
channel,
|
||||||
} else {
|
peer,
|
||||||
channel->session().api().chatParticipants().kick(
|
ChatRestrictionsInfo(), // Unused.
|
||||||
channel,
|
ChatRestrictionsInfo(restrictions, 0),
|
||||||
peer,
|
nullptr,
|
||||||
{ channel->restrictions(), 0 });
|
nullptr);
|
||||||
|
} else {
|
||||||
|
channel->session().api().chatParticipants().kick(
|
||||||
|
channel,
|
||||||
|
peer,
|
||||||
|
{ channel->restrictions(), 0 });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
sequentiallyRequest(request, controller->collectRequests());
|
||||||
}
|
}
|
||||||
});
|
}, ban->lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto close = crl::guard(box, [=] { box->closeBox(); });
|
const auto close = crl::guard(box, [=] { box->closeBox(); });
|
||||||
|
|
Loading…
Add table
Reference in a new issue