Don't rejoin voice chats in left basic groups.

This commit is contained in:
levlam 2021-02-15 19:27:45 +03:00
parent aa2f645d74
commit f9ef4c0c36

View File

@ -2140,9 +2140,13 @@ void GroupCallManager::on_group_call_left_impl(GroupCall *group_call, bool need_
CHECK(group_call != nullptr && group_call->is_inited && group_call->is_joined);
group_call->is_joined = false;
group_call->need_rejoin = need_rejoin && !group_call->is_being_left;
if (group_call->need_rejoin && group_call->dialog_id.is_valid() &&
!td_->messages_manager_->have_input_peer(group_call->dialog_id, AccessRights::Read)) {
group_call->need_rejoin = false;
if (group_call->need_rejoin && group_call->dialog_id.is_valid()) {
auto dialog_id = group_call->dialog_id;
if (!td_->messages_manager_->have_input_peer(dialog_id, AccessRights::Read) ||
(dialog_id.get_type() == DialogType::Chat &&
!td_->contacts_manager_->get_chat_status(dialog_id.get_chat_id()).is_member())) {
group_call->need_rejoin = false;
}
}
group_call->is_being_left = false;
group_call->is_speaking = false;