Replaced channel participant parsing with modern way in admin log.

This commit is contained in:
23rd 2024-09-09 14:43:43 +03:00
parent 975460d268
commit 686e9643ad

View file

@ -1550,20 +1550,20 @@ void InnerWidget::suggestRestrictParticipant(
_channel->inputChannel, _channel->inputChannel,
user->input user->input
)).done([=](const MTPchannels_ChannelParticipant &result) { )).done([=](const MTPchannels_ChannelParticipant &result) {
Expects(result.type() == mtpc_channels_channelParticipant); user->owner().processUsers(result.data().vusers());
auto &participant = result.c_channels_channelParticipant(); const auto participant = Api::ChatParticipant(
_channel->owner().processUsers(participant.vusers()); result.data().vparticipant(),
auto type = participant.vparticipant().type(); user);
if (type == mtpc_channelParticipantBanned) { using Type = Api::ChatParticipant::Type;
auto &banned = participant.vparticipant().c_channelParticipantBanned(); if (participant.type() == Type::Creator
|| participant.type() == Type::Admin) {
editRestrictions(true, {});
} else if (participant.type() == Type::Restricted
|| participant.type() == Type::Banned) {
editRestrictions( editRestrictions(
false, false,
ChatRestrictionsInfo(banned.vbanned_rights())); participant.restrictions());
} else {
auto hasAdminRights = (type == mtpc_channelParticipantAdmin)
|| (type == mtpc_channelParticipantCreator);
editRestrictions(hasAdminRights, ChatRestrictionsInfo());
} }
}).fail([=] { }).fail([=] {
editRestrictions(false, ChatRestrictionsInfo()); editRestrictions(false, ChatRestrictionsInfo());