diff --git a/td/telegram/MessageReaction.cpp b/td/telegram/MessageReaction.cpp index 4dacf1897..32643dec1 100644 --- a/td/telegram/MessageReaction.cpp +++ b/td/telegram/MessageReaction.cpp @@ -9,6 +9,7 @@ #include "td/telegram/AccessRights.h" #include "td/telegram/ConfigManager.h" #include "td/telegram/ContactsManager.h" +#include "td/telegram/Dependencies.h" #include "td/telegram/Global.h" #include "td/telegram/MessageSender.h" #include "td/telegram/MessagesManager.h" @@ -804,6 +805,17 @@ vector> MessageReactions::get_messag }); } +void MessageReactions::add_dependencies(Dependencies &dependencies) const { + for (const auto &reaction : reactions_) { + const auto &dialog_ids = reaction.get_recent_chooser_dialog_ids(); + for (auto dialog_id : dialog_ids) { + // don't load the dialog itself + // it will be created in get_message_reaction_object if needed + dependencies.add_dialog_dependencies(dialog_id); + } + } +} + bool MessageReactions::need_update_message_reactions(const MessageReactions *old_reactions, const MessageReactions *new_reactions) { if (old_reactions == nullptr) { diff --git a/td/telegram/MessageReaction.h b/td/telegram/MessageReaction.h index 6d3952bd9..9a84cf6bb 100644 --- a/td/telegram/MessageReaction.h +++ b/td/telegram/MessageReaction.h @@ -24,6 +24,8 @@ namespace td { +class Dependencies; + class Td; class MessageReaction { @@ -173,6 +175,8 @@ struct MessageReactions { vector> get_message_reactions_object(Td *td, UserId my_user_id, UserId peer_user_id) const; + void add_dependencies(Dependencies &dependencies) const; + static bool need_update_message_reactions(const MessageReactions *old_reactions, const MessageReactions *new_reactions); diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 11b82c236..5c197418e 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -25505,13 +25505,8 @@ void MessagesManager::add_message_dependencies(Dependencies &dependencies, const LOG(INFO) << "Add min reacted " << recent_chooser_min_channel.first; td_->contacts_manager_->add_min_channel(recent_chooser_min_channel.first, recent_chooser_min_channel.second); } - const auto &dialog_ids = reaction.get_recent_chooser_dialog_ids(); - for (auto dialog_id : dialog_ids) { - // don't load the dialog itself - // it will be created in get_message_reaction_object if needed - dependencies.add_dialog_dependencies(dialog_id); - } } + m->reactions->add_dependencies(dependencies); } add_message_content_dependencies(dependencies, m->content.get()); add_reply_markup_dependencies(dependencies, m->reply_markup.get());