Fix mute another voice chat admin.

This commit is contained in:
John Preston 2020-12-15 20:02:28 +04:00
parent 945fa2dd4b
commit 6b5c422e95
2 changed files with 25 additions and 3 deletions

View File

@ -965,7 +965,29 @@ base::unique_qptr<Ui::PopupMenu> MembersController::rowContextMenu(
parent,
st::groupCallPopupMenu);
const auto mute = (real->state() != Row::State::Muted);
const auto muteState = real->state();
const auto admin = [&] {
if (const auto chat = _peer->asChat()) {
return chat->admins.contains(user)
|| (chat->creator == user->bareId());
} else if (const auto group = _peer->asMegagroup()) {
if (const auto mgInfo = group->mgInfo.get()) {
if (mgInfo->creator == user) {
return true;
}
const auto i = mgInfo->lastAdmins.find(user);
if (i == mgInfo->lastAdmins.end()) {
return false;
}
const auto &rights = i->second.rights;
return rights.c_chatAdminRights().is_manage_call();
}
}
return false;
}();
const auto mute = admin
? (muteState == Row::State::Active)
: (muteState != Row::State::Muted);
const auto toggleMute = crl::guard(this, [=] {
_toggleMuteRequests.fire(MuteRequest{
.user = user,
@ -1020,7 +1042,7 @@ base::unique_qptr<Ui::PopupMenu> MembersController::rowContextMenu(
_kickMemberRequests.fire_copy(user);
});
if (_peer->canManageGroupCall()) {
if (_peer->canManageGroupCall() && (!admin || mute)) {
result->addAction(
(mute
? tr::lng_group_call_context_mute(tr::now)

@ -1 +1 @@
Subproject commit e08a0de35dd2d0bbf26d88d127ac7b80efb94150
Subproject commit 300c5a9c6638fd5ad797357246c7ef08a2587ab8