diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index c360f0893..06abf3f95 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -10334,7 +10334,7 @@ void ContactsManager::on_get_chat_full(tl_object_ptr &&c // use send closure later to not crete synchronously default_join_group_call_as_dialog_id send_closure_later(G()->messages_manager(), &MessagesManager::on_update_dialog_default_join_group_call_as_dialog_id, DialogId(chat_id), - default_join_group_call_as_dialog_id); + default_join_group_call_as_dialog_id, false); } { MessageTtlSetting message_ttl_setting; @@ -10543,7 +10543,7 @@ void ContactsManager::on_get_chat_full(tl_object_ptr &&c // use send closure later to not crete synchronously default_join_group_call_as_dialog_id send_closure_later(G()->messages_manager(), &MessagesManager::on_update_dialog_default_join_group_call_as_dialog_id, DialogId(channel_id), - default_join_group_call_as_dialog_id); + default_join_group_call_as_dialog_id, false); } if (participant_count >= 190) { diff --git a/td/telegram/GroupCallManager.cpp b/td/telegram/GroupCallManager.cpp index 6306144f6..63f105100 100644 --- a/td/telegram/GroupCallManager.cpp +++ b/td/telegram/GroupCallManager.cpp @@ -1680,7 +1680,8 @@ void GroupCallManager::join_group_call(GroupCallId group_call_id, DialogId as_di as_dialog_id = DialogId(td_->contacts_manager_->get_my_id()); } if (group_call->dialog_id.is_valid()) { - td_->messages_manager_->on_update_dialog_default_join_group_call_as_dialog_id(group_call->dialog_id, as_dialog_id); + td_->messages_manager_->on_update_dialog_default_join_group_call_as_dialog_id(group_call->dialog_id, as_dialog_id, + true); } else { td_->messages_manager_->force_create_dialog(as_dialog_id, "join_group_call"); } diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 9eddbe3cc..15467475b 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -29791,12 +29791,20 @@ void MessagesManager::on_update_dialog_group_call_id(DialogId dialog_id, InputGr } void MessagesManager::on_update_dialog_default_join_group_call_as_dialog_id(DialogId dialog_id, - DialogId default_join_as_dialog_id) { + DialogId default_join_as_dialog_id, + bool force) { auto d = get_dialog_force(dialog_id); if (d == nullptr) { // nothing to do return; } + + if (!force && d->active_group_call_id.is_valid() && + td_->group_call_manager_->is_group_call_being_joined(d->active_group_call_id)) { + LOG(INFO) << "Ignore default_join_as_dialog_id update in a being joined group call"; + return; + } + if (default_join_as_dialog_id.is_valid()) { force_create_dialog(default_join_as_dialog_id, "on_update_dialog_default_join_group_call_as_dialog_id"); } @@ -34018,7 +34026,7 @@ void MessagesManager::fix_new_dialog(Dialog *d, unique_ptr &&last_datab pending_add_default_join_group_call_as_dialog_id_.erase(it); for (auto &pending_dialog_id : pending_dialog_ids) { - on_update_dialog_default_join_group_call_as_dialog_id(pending_dialog_id, dialog_id); + on_update_dialog_default_join_group_call_as_dialog_id(pending_dialog_id, dialog_id, false); } } } @@ -34124,7 +34132,7 @@ void MessagesManager::fix_new_dialog(Dialog *d, unique_ptr &&last_datab << dialog_id; pending_add_default_join_group_call_as_dialog_id_[default_join_group_call_as_dialog_id].push_back(dialog_id); } else { - on_update_dialog_default_join_group_call_as_dialog_id(dialog_id, default_join_group_call_as_dialog_id); + on_update_dialog_default_join_group_call_as_dialog_id(dialog_id, default_join_group_call_as_dialog_id, false); } } diff --git a/td/telegram/MessagesManager.h b/td/telegram/MessagesManager.h index c0e3487ba..8777beb3e 100644 --- a/td/telegram/MessagesManager.h +++ b/td/telegram/MessagesManager.h @@ -290,7 +290,8 @@ class MessagesManager : public Actor { void on_update_dialog_group_call_id(DialogId dialog_id, InputGroupCallId input_group_call_id); - void on_update_dialog_default_join_group_call_as_dialog_id(DialogId dialog_id, DialogId default_join_as_dialog_id); + void on_update_dialog_default_join_group_call_as_dialog_id(DialogId dialog_id, DialogId default_join_as_dialog_id, + bool force); void on_update_dialog_message_ttl_setting(DialogId dialog_id, MessageTtlSetting message_ttl_setting);