2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-01 15:15:13 +00:00

Allow creating approve-only invite links.

This commit is contained in:
John Preston
2021-10-12 12:39:07 +04:00
parent e471d61d7a
commit 3af3f85f82
20 changed files with 259 additions and 52 deletions

View File

@@ -146,6 +146,9 @@ void ChatData::setAdminRights(ChatAdminRights rights) {
return;
}
_adminRights.set(rights);
if (!canHaveInviteLink()) {
setPendingRequestsCount(0);
}
session().changes().peerUpdated(
this,
UpdateFlag::Rights | UpdateFlag::Admins | UpdateFlag::BannedUsers);
@@ -258,6 +261,13 @@ void ChatData::setBotCommands(
}
}
void ChatData::setPendingRequestsCount(int count) {
if (_pendingRequestsCount != count) {
_pendingRequestsCount = count;
session().changes().peerUpdated(this, UpdateFlag::PendingRequests);
}
}
namespace Data {
void ApplyChatUpdate(
@@ -431,6 +441,8 @@ void ApplyChatUpdate(not_null<ChatData*> chat, const MTPDchatFull &update) {
chat->setThemeEmoji(qs(update.vtheme_emoticon().value_or_empty()));
chat->fullUpdated();
chat->setAbout(qs(update.vabout()));
chat->setPendingRequestsCount(
update.vrequests_pending().value_or_empty());
chat->session().api().applyNotifySettings(
MTP_inputNotifyPeer(chat->input),