2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Add EditPeerPermissionsBox.

This commit is contained in:
John Preston
2019-01-08 14:54:18 +04:00
parent f4d52b82b4
commit eff90395b6
20 changed files with 469 additions and 142 deletions

View File

@@ -1636,6 +1636,39 @@ void ApiWrap::unblockParticipant(
_kickRequests.emplace(kick, requestId);
}
void ApiWrap::saveDefaultRestrictions(
not_null<PeerData*> peer,
const MTPChatBannedRights &rights,
Fn<void(bool)> callback) {
if (_defaultRestrictionsRequests.contains(peer)) {
return;
}
const auto requestId = request(MTPmessages_EditChatDefaultBannedRights(
peer->input,
rights
)).done([=](const MTPUpdates &result) {
_defaultRestrictionsRequests.erase(peer);
applyUpdates(result);
if (callback) {
callback(true);
}
}).fail([=](const RPCError &error) {
_defaultRestrictionsRequests.erase(peer);
if (error.type() == qstr("CHAT_NOT_MODIFIED")) {
if (const auto chat = peer->asChat()) {
chat->setDefaultRestrictions(rights);
if (callback) {
callback(true);
}
return;
}
}
if (callback) {
callback(false);
}
}).send();
}
void ApiWrap::deleteAllFromUser(
not_null<ChannelData*> channel,
not_null<UserData*> from) {