From 909bd3dd2d4df8a613f3b00efebfb4959c6bb112 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 7 Apr 2025 14:42:38 +0400 Subject: [PATCH] Allow kicking from confcall by creator. --- Telegram/Resources/langs/lang.strings | 1 + Telegram/SourceFiles/calls/group/calls_group_call.cpp | 3 ++- .../SourceFiles/calls/group/calls_group_members.cpp | 7 +++++-- Telegram/SourceFiles/calls/group/calls_group_panel.cpp | 10 ++++++++-- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 173c80b597..71f5e3ef49 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -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."; diff --git a/Telegram/SourceFiles/calls/group/calls_group_call.cpp b/Telegram/SourceFiles/calls/group/calls_group_call.cpp index 2ea46d9dd5..c8399d35c9 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_call.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_call.cpp @@ -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(); diff --git a/Telegram/SourceFiles/calls/group/calls_group_members.cpp b/Telegram/SourceFiles/calls/group/calls_group_members.cpp index 52d787421d..5b4e87b622 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_members.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_members.cpp @@ -1481,11 +1481,12 @@ base::unique_qptr 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 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 diff --git a/Telegram/SourceFiles/calls/group/calls_group_panel.cpp b/Telegram/SourceFiles/calls/group/calls_group_panel.cpp index 748438bb49..27771e27db 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_panel.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_panel.cpp @@ -1599,7 +1599,9 @@ void Panel::kickParticipant(not_null 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 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 = [&] {