Fix group call version initialization.

This commit is contained in:
levlam 2020-12-15 15:40:52 +03:00
parent ecc1669e5a
commit adca19d4da
2 changed files with 15 additions and 0 deletions

View File

@ -1624,6 +1624,15 @@ InputGroupCallId GroupCallManager::update_group_call(const tl_object_ptr<telegra
}
if (!group_call->is_inited) {
*group_call = std::move(call);
if (need_group_call_participants(input_group_call_id)) {
// init version
group_call->version = call.version;
if (process_pending_group_call_participant_updates(input_group_call_id)) {
need_update = false;
}
} else {
group_call->version = -1;
}
need_update = true;
} else {
if (!group_call->is_active) {

View File

@ -7970,6 +7970,7 @@ void MessagesManager::remove_dialog_action_bar(DialogId dialog_id, Promise<Unit>
void MessagesManager::repair_dialog_active_group_call_id(DialogId dialog_id) {
if (have_input_peer(dialog_id, AccessRights::Read)) {
LOG(INFO) << "Repair active voice chat ID in " << dialog_id;
create_actor<SleepActor>("RepairChatActiveVoiceChatId", 1.0,
PromiseCreator::lambda([actor_id = actor_id(this), dialog_id](Result<Unit> result) {
send_closure(actor_id, &MessagesManager::do_repair_dialog_active_group_call_id,
@ -28977,9 +28978,13 @@ void MessagesManager::on_update_dialog_group_call(DialogId dialog_id, bool has_a
return;
}
LOG(INFO) << "Update voice chat in " << dialog_id << " with has_active_voice_chat = " << has_active_group_call
<< " and is_voice_chat_empty = " << is_group_call_empty;
CHECK(dialog_id.is_valid());
Dialog *d = get_dialog(dialog_id); // must not create the Dialog, because is called from on_get_chat
if (d == nullptr) {
LOG(INFO) << "Can't find " << dialog_id;
pending_dialog_group_call_updates_[dialog_id] = {has_active_group_call, is_group_call_empty};
return;
}
@ -28988,6 +28993,7 @@ void MessagesManager::on_update_dialog_group_call(DialogId dialog_id, bool has_a
is_group_call_empty = false;
}
if (d->has_active_group_call == has_active_group_call && d->is_group_call_empty == is_group_call_empty) {
LOG(INFO) << "Nothing changed in " << dialog_id;
return;
}