diff --git a/Telegram/SourceFiles/calls/calls_top_bar.cpp b/Telegram/SourceFiles/calls/calls_top_bar.cpp index dea58fd2f1..06863bc34f 100644 --- a/Telegram/SourceFiles/calls/calls_top_bar.cpp +++ b/Telegram/SourceFiles/calls/calls_top_bar.cpp @@ -424,7 +424,7 @@ void TopBar::initControls() { if (const auto call = _call.get()) { call->hangup(); } else if (const auto group = _groupCall.get()) { - if (!group->peer()->canManageGroupCall()) { + if (!group->canManage()) { group->hangup(); } else { _show->showBox( diff --git a/Telegram/SourceFiles/calls/group/calls_group_call.cpp b/Telegram/SourceFiles/calls/group/calls_group_call.cpp index bd1bf41863..f7e4355c4e 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_call.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_call.cpp @@ -1239,8 +1239,13 @@ void GroupCall::join(const MTPInputGroupCall &inputCall) { } }, _lifetime); + if (_conferenceCall) { + _canManage = _conferenceCall->canManage(); + return; + } _peer->session().updates().addActiveChat( _peerStream.events_starting_with_copy(_peer)); + _canManage = Data::CanManageGroupCallValue(_peer); SubscribeToMigration(_peer, _lifetime, [=](not_null group) { _peer = group; _canManage = Data::CanManageGroupCallValue(_peer); diff --git a/Telegram/SourceFiles/calls/group/calls_group_members.cpp b/Telegram/SourceFiles/calls/group/calls_group_members.cpp index 03f9610706..cf5c3b42bf 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_members.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_members.cpp @@ -615,7 +615,7 @@ bool Members::Controller::needToReorder(not_null row) const { if (row->speaking()) { return !allRowsAboveAreSpeaking(row); - } else if (!_peer->canManageGroupCall()) { + } else if (!_call->canManage()) { // Raising hands reorder participants only for voice chat admins. return false; } @@ -684,7 +684,7 @@ void Members::Controller::checkRowPosition(not_null row) { return proj(a) > proj(b); }; }; - delegate()->peerListSortRows(_peer->canManageGroupCall() + delegate()->peerListSortRows(_call->canManage() ? makeComparator(projForAdmin) : makeComparator(projForOther)); } @@ -919,7 +919,7 @@ bool Members::Controller::rowIsMe(not_null participantPeer) { } bool Members::Controller::rowCanMuteMembers() { - return _peer->canManageGroupCall(); + return _call->canManage(); } void Members::Controller::rowUpdateRow(not_null row) { @@ -1317,7 +1317,7 @@ base::unique_qptr Members::Controller::createRowContextMenu( false, static_cast(row.get())); } else if (participant - && (!isMe(participantPeer) || _peer->canManageGroupCall()) + && (!isMe(participantPeer) || _call->canManage()) && (participant->ssrc != 0 || GetAdditionalAudioSsrc(participant->videoParams) != 0)) { addMuteActionsToContextMenu( @@ -1387,11 +1387,11 @@ void Members::Controller::addMuteActionsToContextMenu( bool participantIsCallAdmin, not_null row) { const auto muteUnmuteString = [=](bool muted, bool mutedByMe) { - return (muted && _peer->canManageGroupCall()) + return (muted && _call->canManage()) ? tr::lng_group_call_context_unmute(tr::now) : mutedByMe ? tr::lng_group_call_context_unmute_for_me(tr::now) - : _peer->canManageGroupCall() + : _call->canManage() ? tr::lng_group_call_context_mute(tr::now) : tr::lng_group_call_context_mute_for_me(tr::now); }; @@ -1488,7 +1488,7 @@ void Members::Controller::addMuteActionsToContextMenu( || isMe(participantPeer) || (muteState == Row::State::Inactive && participantIsCallAdmin - && _peer->canManageGroupCall())) { + && _call->canManage())) { return nullptr; } auto callback = [=] { diff --git a/Telegram/SourceFiles/calls/group/calls_group_menu.cpp b/Telegram/SourceFiles/calls/group/calls_group_menu.cpp index 4f1b196d65..b41dac66c6 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_menu.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_menu.cpp @@ -441,7 +441,7 @@ void LeaveBox( : tr::lng_group_call_leave_sure())), (inCall ? st::groupCallBoxLabel : st::boxLabel)), scheduled ? st::boxPadding : st::boxRowPadding); - const auto discard = call->peer()->canManageGroupCall() + const auto discard = call->canManage() ? box->addRow(object_ptr( box.get(), (scheduled @@ -507,9 +507,12 @@ void FillMenu( return; } + const auto conference = call->conference(); const auto addEditJoinAs = call->showChooseJoinAs(); - const auto addEditTitle = call->canManage(); - const auto addEditRecording = call->canManage() && !real->scheduleDate(); + const auto addEditTitle = !conference && call->canManage(); + const auto addEditRecording = !conference + && call->canManage() + && !real->scheduleDate(); const auto addScreenCast = !wide && call->videoIsWorking() && !real->scheduleDate(); diff --git a/Telegram/SourceFiles/calls/group/calls_group_settings.cpp b/Telegram/SourceFiles/calls/group/calls_group_settings.cpp index 7c2bdfd4ce..0adbb8e3e9 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_settings.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_settings.cpp @@ -766,7 +766,7 @@ void SettingsBox( }, volumeItem->lifetime()); } - if (peer->canManageGroupCall()) { + if (call->canManage()) { layout->add(object_ptr( layout, (peer->isBroadcast() diff --git a/Telegram/SourceFiles/data/data_group_call.cpp b/Telegram/SourceFiles/data/data_group_call.cpp index b90e0f24c3..dd6e449cbb 100644 --- a/Telegram/SourceFiles/data/data_group_call.cpp +++ b/Telegram/SourceFiles/data/data_group_call.cpp @@ -128,6 +128,10 @@ bool GroupCall::rtmp() const { return _rtmp; } +bool GroupCall::canManage() const { + return _conference ? _creator : _peer->canManageGroupCall(); +} + bool GroupCall::listenersHidden() const { return _listenersHidden; } @@ -539,6 +543,7 @@ void GroupCall::applyCallFields(const MTPDgroupCall &data) { _version = 1; } _rtmp = data.is_rtmp_stream(); + _creator = data.is_creator(); _listenersHidden = data.is_listeners_hidden(); _joinMuted = data.is_join_muted(); _canChangeJoinMuted = data.is_can_change_join_muted(); diff --git a/Telegram/SourceFiles/data/data_group_call.h b/Telegram/SourceFiles/data/data_group_call.h index f413f3f70b..54c6990015 100644 --- a/Telegram/SourceFiles/data/data_group_call.h +++ b/Telegram/SourceFiles/data/data_group_call.h @@ -78,6 +78,7 @@ public: [[nodiscard]] CallId id() const; [[nodiscard]] bool loaded() const; [[nodiscard]] bool rtmp() const; + [[nodiscard]] bool canManage() const; [[nodiscard]] bool listenersHidden() const; [[nodiscard]] not_null peer() const; [[nodiscard]] MTPInputGroupCall input() const; @@ -271,6 +272,7 @@ private: mtpRequestId _checkStaleRequestId = 0; rpl::lifetime _checkStaleLifetime; + bool _creator : 1 = false; bool _joinMuted : 1 = false; bool _canChangeJoinMuted : 1 = true; bool _allParticipantsLoaded : 1 = false;