Add MessageReactions::add_min_channels.

This commit is contained in:
levlam 2022-09-24 21:09:07 +03:00
parent 375446ac88
commit 798f4fdb2f
3 changed files with 12 additions and 6 deletions

View File

@ -805,6 +805,15 @@ vector<td_api::object_ptr<td_api::messageReaction>> MessageReactions::get_messag
});
}
void MessageReactions::add_min_channels(Td *td) const {
for (const auto &reaction : reactions_) {
for (const auto &recent_chooser_min_channel : reaction.get_recent_chooser_min_channels()) {
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);
}
}
}
void MessageReactions::add_dependencies(Dependencies &dependencies) const {
for (const auto &reaction : reactions_) {
const auto &dialog_ids = reaction.get_recent_chooser_dialog_ids();

View File

@ -175,6 +175,8 @@ struct MessageReactions {
vector<td_api::object_ptr<td_api::messageReaction>> get_message_reactions_object(Td *td, UserId my_user_id,
UserId peer_user_id) const;
void add_min_channels(Td *td) const;
void add_dependencies(Dependencies &dependencies) const;
static bool need_update_message_reactions(const MessageReactions *old_reactions,

View File

@ -25500,12 +25500,7 @@ void MessagesManager::add_message_dependencies(Dependencies &dependencies, const
dependencies.add_dialog_dependencies(recent_replier_dialog_id);
}
if (m->reactions != nullptr) {
for (const auto &reaction : m->reactions->reactions_) {
for (const auto &recent_chooser_min_channel : reaction.get_recent_chooser_min_channels()) {
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);
}
}
m->reactions->add_min_channels(td_);
m->reactions->add_dependencies(dependencies);
}
add_message_content_dependencies(dependencies, m->content.get());