Add MessageReactions::get_message_reactions_object.

This commit is contained in:
levlam 2022-09-24 20:58:54 +03:00
parent c9f7603ad7
commit da00ea6f86
3 changed files with 12 additions and 4 deletions

View File

@ -797,6 +797,13 @@ bool MessageReactions::are_consistent_with_list(const string &reaction, FlatHash
}
}
vector<td_api::object_ptr<td_api::messageReaction>> MessageReactions::get_message_reactions_object(
Td *td, UserId my_user_id, UserId peer_user_id) const {
return transform(reactions_, [td, my_user_id, peer_user_id](const MessageReaction &reaction) {
return reaction.get_message_reaction_object(td, my_user_id, peer_user_id);
});
}
bool MessageReactions::need_update_message_reactions(const MessageReactions *old_reactions,
const MessageReactions *new_reactions) {
if (old_reactions == nullptr) {

View File

@ -13,6 +13,7 @@
#include "td/telegram/MinChannel.h"
#include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h"
#include "td/telegram/UserId.h"
#include "td/utils/common.h"
#include "td/utils/FlatHashMap.h"
@ -169,6 +170,9 @@ struct MessageReactions {
bool are_consistent_with_list(const string &reaction, FlatHashMap<string, vector<DialogId>> reactions,
int32 total_count) const;
vector<td_api::object_ptr<td_api::messageReaction>> get_message_reactions_object(Td *td, UserId my_user_id,
UserId peer_user_id) const;
static bool need_update_message_reactions(const MessageReactions *old_reactions,
const MessageReactions *new_reactions);

View File

@ -6936,10 +6936,7 @@ td_api::object_ptr<td_api::messageInteractionInfo> MessagesManager::get_message_
my_user_id = td_->contacts_manager_->get_my_id();
peer_user_id = dialog_id.get_user_id();
}
reactions =
transform(m->reactions->reactions_, [td = td_, my_user_id, peer_user_id](const MessageReaction &reaction) {
return reaction.get_message_reaction_object(td, my_user_id, peer_user_id);
});
reactions = m->reactions->get_message_reactions_object(td_, my_user_id, peer_user_id);
}
return td_api::make_object<td_api::messageInteractionInfo>(m->view_count, m->forward_count, std::move(reply_info),