Forcely create all chats needed for a message before adding it.

This commit is contained in:
levlam 2023-07-03 14:09:17 +03:00
parent 9da2c92ff0
commit 8bc4d800bb
2 changed files with 12 additions and 1 deletions

View File

@ -114,7 +114,7 @@ bool Dependencies::resolve_force(Td *td, const char *source) const {
for (auto dialog_id : dialog_ids) {
if (!td->messages_manager_->have_dialog_force(dialog_id, source)) {
LOG(ERROR) << "Can't find " << dialog_id << " from " << source;
td->messages_manager_->force_create_dialog(dialog_id, "resolve_dependencies_force", true);
td->messages_manager_->force_create_dialog(dialog_id, source, true);
success = false;
}
}

View File

@ -6649,6 +6649,12 @@ void MessagesManager::on_update_service_notification(tl_object_ptr<telegram_api:
bool need_update = true;
bool need_update_dialog_pos = false;
Dependencies dependencies;
add_message_dependencies(dependencies, new_message.get());
for (auto dependent_dialog_id : dependencies.get_dialog_ids()) {
force_create_dialog(dependent_dialog_id, "on_update_service_notification", true);
}
const Message *m = add_message_to_dialog(d, std::move(new_message), false, true, &need_update,
&need_update_dialog_pos, "on_update_service_notification");
if (m != nullptr && need_update) {
@ -14847,6 +14853,11 @@ FullMessageId MessagesManager::on_get_message(MessageInfo &&message_info, const
if (d == nullptr) {
d = add_dialog_for_new_message(dialog_id, from_update, &need_update_dialog_pos, source);
}
Dependencies dependencies;
add_message_dependencies(dependencies, new_message.get());
for (auto dependent_dialog_id : dependencies.get_dialog_ids()) {
force_create_dialog(dependent_dialog_id, source, true);
}
const Message *m = add_message_to_dialog(d, std::move(new_message), false, from_update, &need_update,
&need_update_dialog_pos, source);