Add add_message_sender_dependencies function.

GitOrigin-RevId: 70f6ac49b7769d707079956df858e98409704a90
This commit is contained in:
levlam 2020-10-19 19:17:56 +03:00
parent 9a3653a017
commit 91cf083c94
3 changed files with 11 additions and 5 deletions

View File

@ -43,6 +43,14 @@ void add_dialog_dependencies(Dependencies &dependencies, DialogId dialog_id) {
} }
} }
void add_message_sender_dependencies(Dependencies &dependencies, DialogId dialog_id) {
if (dialog_id.get_type() == DialogType::User) {
dependencies.user_ids.insert(dialog_id.get_user_id());
} else {
add_dialog_and_dependencies(dependencies, dialog_id);
}
}
void resolve_dependencies_force(Td *td, const Dependencies &dependencies, const char *source) { void resolve_dependencies_force(Td *td, const Dependencies &dependencies, const char *source) {
for (auto user_id : dependencies.user_ids) { for (auto user_id : dependencies.user_ids) {
if (user_id.is_valid() && !td->contacts_manager_->have_user_force(user_id)) { if (user_id.is_valid() && !td->contacts_manager_->have_user_force(user_id)) {

View File

@ -32,6 +32,8 @@ void add_dialog_and_dependencies(Dependencies &dependencies, DialogId dialog_id)
void add_dialog_dependencies(Dependencies &dependencies, DialogId dialog_id); void add_dialog_dependencies(Dependencies &dependencies, DialogId dialog_id);
void add_message_sender_dependencies(Dependencies &dependencies, DialogId dialog_id);
void resolve_dependencies_force(Td *td, const Dependencies &dependencies, const char *source); void resolve_dependencies_force(Td *td, const Dependencies &dependencies, const char *source);
} // namespace td } // namespace td

View File

@ -22481,11 +22481,7 @@ void MessagesManager::add_message_dependencies(Dependencies &dependencies, Dialo
add_dialog_and_dependencies(dependencies, m->forward_info->from_dialog_id); add_dialog_and_dependencies(dependencies, m->forward_info->from_dialog_id);
} }
for (auto recent_replier_dialog_id : m->reply_info.recent_replier_dialog_ids) { for (auto recent_replier_dialog_id : m->reply_info.recent_replier_dialog_ids) {
if (recent_replier_dialog_id.get_type() == DialogType::User) { add_message_sender_dependencies(dependencies, recent_replier_dialog_id);
dependencies.user_ids.insert(recent_replier_dialog_id.get_user_id());
} else {
add_dialog_and_dependencies(dependencies, recent_replier_dialog_id);
}
} }
add_message_content_dependencies(dependencies, m->content.get()); add_message_content_dependencies(dependencies, m->content.get());
} }