mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-08 08:04:08 +02:00
Fix voice chat menu for admins editing admins.
This commit is contained in:
parent
fba7bd7807
commit
e0680fc2a5
2 changed files with 15 additions and 4 deletions
|
@ -409,11 +409,11 @@ void GroupCall::applyParticipantLocally(
|
||||||
const auto mutedCount = 0/*participant->mutedCount*/;
|
const auto mutedCount = 0/*participant->mutedCount*/;
|
||||||
using Flag = MTPDgroupCallParticipant::Flag;
|
using Flag = MTPDgroupCallParticipant::Flag;
|
||||||
const auto flags = (canSelfUnmute ? Flag::f_can_self_unmute : Flag(0))
|
const auto flags = (canSelfUnmute ? Flag::f_can_self_unmute : Flag(0))
|
||||||
| (volume.has_value() ? Flag::f_volume : Flag(0))
|
| Flag::f_volume // Without flag the volume is reset to 100%.
|
||||||
| (participant->lastActive ? Flag::f_active_date : Flag(0))
|
| (participant->lastActive ? Flag::f_active_date : Flag(0))
|
||||||
| (!mute
|
| (!mute
|
||||||
? Flag(0)
|
? Flag(0)
|
||||||
: user->canManageGroupCall()
|
: _peer->canManageGroupCall()
|
||||||
? Flag::f_muted
|
? Flag::f_muted
|
||||||
: Flag::f_muted_by_you);
|
: Flag::f_muted_by_you);
|
||||||
_peer->groupCall()->applyUpdateChecked(
|
_peer->groupCall()->applyUpdateChecked(
|
||||||
|
|
|
@ -295,6 +295,7 @@ private:
|
||||||
void addMuteActionsToContextMenu(
|
void addMuteActionsToContextMenu(
|
||||||
not_null<Ui::PopupMenu*> menu,
|
not_null<Ui::PopupMenu*> menu,
|
||||||
not_null<UserData*> user,
|
not_null<UserData*> user,
|
||||||
|
bool userIsCallAdmin,
|
||||||
not_null<Row*> row);
|
not_null<Row*> row);
|
||||||
void setupListChangeViewers(not_null<GroupCall*> call);
|
void setupListChangeViewers(not_null<GroupCall*> call);
|
||||||
void subscribeToChanges(not_null<Data::GroupCall*> real);
|
void subscribeToChanges(not_null<Data::GroupCall*> real);
|
||||||
|
@ -1356,7 +1357,7 @@ base::unique_qptr<Ui::PopupMenu> MembersController::createRowContextMenu(
|
||||||
});
|
});
|
||||||
|
|
||||||
if (real->ssrc() != 0) {
|
if (real->ssrc() != 0) {
|
||||||
addMuteActionsToContextMenu(result, user, real);
|
addMuteActionsToContextMenu(result, user, admin, real);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!user->isSelf()) {
|
if (!user->isSelf()) {
|
||||||
|
@ -1389,6 +1390,7 @@ base::unique_qptr<Ui::PopupMenu> MembersController::createRowContextMenu(
|
||||||
void MembersController::addMuteActionsToContextMenu(
|
void MembersController::addMuteActionsToContextMenu(
|
||||||
not_null<Ui::PopupMenu*> menu,
|
not_null<Ui::PopupMenu*> menu,
|
||||||
not_null<UserData*> user,
|
not_null<UserData*> user,
|
||||||
|
bool userIsCallAdmin,
|
||||||
not_null<Row*> row) {
|
not_null<Row*> row) {
|
||||||
const auto muteString = [=] {
|
const auto muteString = [=] {
|
||||||
return (_peer->canManageGroupCall()
|
return (_peer->canManageGroupCall()
|
||||||
|
@ -1446,6 +1448,13 @@ void MembersController::addMuteActionsToContextMenu(
|
||||||
|
|
||||||
volumeItem->toggleMuteRequests(
|
volumeItem->toggleMuteRequests(
|
||||||
) | rpl::start_with_next([=](bool muted) {
|
) | rpl::start_with_next([=](bool muted) {
|
||||||
|
if (muted) {
|
||||||
|
// Slider value is changed after the callback is called.
|
||||||
|
// To capture good state inside the slider frame we postpone.
|
||||||
|
crl::on_main(menu, [=] {
|
||||||
|
menu->hideMenu();
|
||||||
|
});
|
||||||
|
}
|
||||||
toggleMute(muted, false);
|
toggleMute(muted, false);
|
||||||
}, volumeItem->lifetime());
|
}, volumeItem->lifetime());
|
||||||
|
|
||||||
|
@ -1472,7 +1481,9 @@ void MembersController::addMuteActionsToContextMenu(
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto muteAction = [&]() -> QAction* {
|
const auto muteAction = [&]() -> QAction* {
|
||||||
if (muteState == Row::State::Invited || user->isSelf()) {
|
if (muteState == Row::State::Invited
|
||||||
|
|| user->isSelf()
|
||||||
|
|| (userIsCallAdmin && row->state() != Row::State::Active)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
auto callback = [=] {
|
auto callback = [=] {
|
||||||
|
|
Loading…
Add table
Reference in a new issue