Allow kicking from confcall by creator.

This commit is contained in:
John Preston 2025-04-07 14:42:38 +04:00
parent d50fad615f
commit 909bd3dd2d
4 changed files with 16 additions and 5 deletions

View file

@ -4960,6 +4960,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_confcall_invite_kicked_many#other" = "**{count} people** were removed from the call.";
"lng_confcall_not_accessible" = "This call is no longer accessible.";
"lng_confcall_participants_limit" = "This call reached the participants limit.";
"lng_confcall_sure_remove" = "Remove {user} from the call?";
"lng_no_mic_permission" = "Telegram needs microphone access so that you can make calls and record voice messages.";

View file

@ -1645,7 +1645,8 @@ void GroupCall::sendJoinRequest() {
}
hangup();
Ui::Toast::Show((type == u"GROUPCALL_FORBIDDEN"_q)
Ui::Toast::Show((type == u"GROUPCALL_FORBIDDEN"_q
|| type == u"GROUPCALL_INVALID"_q)
? tr::lng_confcall_not_accessible(tr::now)
: type);
}).send();

View file

@ -1481,11 +1481,12 @@ base::unique_qptr<Ui::PopupMenu> Members::Controller::createRowContextMenu(
removeHand);
}
} else {
const auto invited = (muteState == Row::State::Invited)
|| (muteState == Row::State::Calling);
const auto conference = _call->conferenceCall().get();
if (conference
&& participantPeer->isUser()
&& (muteState == Row::State::Invited
|| muteState == Row::State::Calling)) {
&& invited) {
const auto id = conference->id();
const auto cancelInvite = [=](bool discard) {
Core::App().calls().declineOutgoingConferenceInvite(
@ -1521,6 +1522,8 @@ base::unique_qptr<Ui::PopupMenu> Members::Controller::createRowContextMenu(
|| muteState == Row::State::Calling
|| muteState == Row::State::WithAccess) {
return false;
} else if (conference && _call->canManage()) {
return true;
} else if (const auto chat = _peer->asChat()) {
return chat->amCreator()
|| (user

View file

@ -1599,7 +1599,9 @@ void Panel::kickParticipant(not_null<PeerData*> participantPeer) {
tr::now,
lt_channel,
participantPeer->name())
: (_peer->isBroadcast()
: (_call->conference()
? tr::lng_confcall_sure_remove
: _peer->isBroadcast()
? tr::lng_profile_sure_kick_channel
: tr::lng_profile_sure_kick)(
tr::now,
@ -1660,7 +1662,11 @@ bool Panel::isLayerShown() const {
}
void Panel::kickParticipantSure(not_null<PeerData*> participantPeer) {
if (const auto chat = _peer->asChat()) {
if (_call->conference()) {
if (const auto user = participantPeer->asUser()) {
_call->removeConferenceParticipants({ peerToUser(user->id) });
}
} else if (const auto chat = _peer->asChat()) {
chat->session().api().chatParticipants().kick(chat, participantPeer);
} else if (const auto channel = _peer->asChannel()) {
const auto currentRestrictedRights = [&] {