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

Added initial ability to enable anti-spam mode in megagroups.

This commit is contained in:
23rd
2022-12-01 01:57:36 +03:00
parent 22f45bc1fb
commit 4bd2091e6e
7 changed files with 165 additions and 3 deletions

View File

@@ -16,6 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/max_invite_box.h"
#include "boxes/add_contact_box.h"
#include "main/main_session.h"
#include "menu/menu_antispam_validator.h"
#include "mtproto/mtproto_config.h"
#include "apiwrap.h"
#include "lang/lang_keys.h"
@@ -1186,6 +1187,12 @@ void ParticipantsBoxController::prepare() {
}
Unexpected("Role in ParticipantsBoxController::prepare()");
}();
if ((_role == Role::Admins) && _peer->isMegagroup()) {
const auto validator = AntiSpamMenu::AntiSpamValidator(
_navigation->parentController(),
_peer->asChannel());
delegate()->peerListSetAboveWidget(validator.createButton());
}
delegate()->peerListSetSearchMode(PeerListSearchMode::Enabled);
delegate()->peerListSetTitle(std::move(title));
setDescriptionText(tr::lng_contacts_loading(tr::now));