mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Save slowmode settings in groups.
This commit is contained in:
@@ -1896,43 +1896,6 @@ 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);
|
||||
} else if (const auto channel = peer->asChannel()) {
|
||||
channel->setDefaultRestrictions(rights);
|
||||
} else {
|
||||
Unexpected("Peer in ApiWrap::saveDefaultRestrictions.");
|
||||
}
|
||||
if (callback) {
|
||||
callback(true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (callback) {
|
||||
callback(false);
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
|
||||
void ApiWrap::deleteAllFromUser(
|
||||
not_null<ChannelData*> channel,
|
||||
not_null<UserData*> from) {
|
||||
@@ -2683,6 +2646,22 @@ void ApiWrap::checkQuitPreventFinished() {
|
||||
}
|
||||
}
|
||||
|
||||
void ApiWrap::registerModifyRequest(
|
||||
const QString &key,
|
||||
mtpRequestId requestId) {
|
||||
const auto i = _modifyRequests.find(key);
|
||||
if (i != end(_modifyRequests)) {
|
||||
request(i->second).cancel();
|
||||
i->second = requestId;
|
||||
} else {
|
||||
_modifyRequests.emplace(key, requestId);
|
||||
}
|
||||
}
|
||||
|
||||
void ApiWrap::clearModifyRequest(const QString &key) {
|
||||
_modifyRequests.remove(key);
|
||||
}
|
||||
|
||||
void ApiWrap::applyNotifySettings(
|
||||
MTPInputNotifyPeer notifyPeer,
|
||||
const MTPPeerNotifySettings &settings) {
|
||||
|
Reference in New Issue
Block a user