From 762592daffcf69e226b31eaff7486c93c3ee9189 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 14 Nov 2024 18:45:56 +0400 Subject: [PATCH] Allow RTMP for manage call admins. --- Telegram/SourceFiles/calls/group/calls_group_rtmp.cpp | 11 +++++++++-- .../history/view/history_view_top_bar_widget.cpp | 6 ++---- Telegram/SourceFiles/window/window_peer_menu.cpp | 7 ++----- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Telegram/SourceFiles/calls/group/calls_group_rtmp.cpp b/Telegram/SourceFiles/calls/group/calls_group_rtmp.cpp index fded07614..db94f72cb 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_rtmp.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_rtmp.cpp @@ -9,7 +9,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "apiwrap.h" #include "calls/group/calls_group_common.h" -#include "data/data_peer.h" +#include "data/data_channel.h" +#include "data/data_chat.h" +#include "data/data_user.h" #include "lang/lang_keys.h" #include "main/main_account.h" #include "main/main_session.h" @@ -169,7 +171,12 @@ void StartRtmpProcess::finish(JoinInfo info) { void StartRtmpProcess::createBox() { auto done = [=] { const auto peer = _request->peer; - finish({ .peer = peer, .joinAs = peer, .rtmp = true }); + const auto joinAs = (peer->isChat() && peer->asChat()->amCreator()) + ? peer + : (peer->isChannel() && peer->asChannel()->amCreator()) + ? peer + : peer->session().user(); + finish({ .peer = peer, .joinAs = joinAs, .rtmp = true }); }; auto revoke = [=] { const auto guard = base::make_weak(&_request->guard); diff --git a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp index 3912e5389..93c0e1ac2 100644 --- a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp @@ -72,10 +72,8 @@ namespace { constexpr auto kEmojiInteractionSeenDuration = 3 * crl::time(1000); -inline bool HasGroupCallMenu(const not_null &peer) { - return !peer->groupCall() - && ((peer->isChannel() && peer->asChannel()->amCreator()) - || (peer->isChat() && peer->asChat()->amCreator())); +[[nodiscard]] inline bool HasGroupCallMenu(not_null peer) { + return !peer->groupCall() && peer->canManageGroupCall(); } QString TopBarNameText( diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index 764ebba2e..5d0c2bc12 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -2798,9 +2798,6 @@ bool FillVideoChatMenu( const auto livestream = !peer->isMegagroup() && peer->isChannel(); const auto has = (peer->groupCall() != nullptr); const auto manager = peer->canManageGroupCall(); - const auto creator = peer->isChat() - ? peer->asChat()->amCreator() - : peer->asChannel()->amCreator(); if (has) { addAction( tr::lng_menu_start_group_call_join(tr::now), @@ -2812,9 +2809,9 @@ bool FillVideoChatMenu( ? tr::lng_menu_start_group_call_channel : tr::lng_menu_start_group_call)(tr::now), [=] { callback({}); }, - creator ? &st::menuIconStartStream : &st::menuIconVideoChat); + &st::menuIconStartStream); } - if (!has && creator) { + if (!has && manager) { addAction( (livestream ? tr::lng_menu_start_group_call_scheduled_channel