Pass all chosen reactions to send_message_reaction.
This commit is contained in:
parent
6b2f6b4204
commit
55ec944266
@ -169,7 +169,7 @@ class SendReactionQuery final : public Td::ResultHandler {
|
||||
explicit SendReactionQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(FullMessageId full_message_id, string reaction, bool is_big, bool add_to_recent) {
|
||||
void send(FullMessageId full_message_id, vector<string> reactions, bool is_big, bool add_to_recent) {
|
||||
dialog_id_ = full_message_id.get_dialog_id();
|
||||
|
||||
auto input_peer = td_->messages_manager_->get_input_peer(dialog_id_, AccessRights::Read);
|
||||
@ -178,7 +178,7 @@ class SendReactionQuery final : public Td::ResultHandler {
|
||||
}
|
||||
|
||||
int32 flags = 0;
|
||||
if (!reaction.empty()) {
|
||||
if (!reactions.empty()) {
|
||||
flags |= telegram_api::messages_sendReaction::REACTION_MASK;
|
||||
|
||||
if (is_big) {
|
||||
@ -190,15 +190,10 @@ class SendReactionQuery final : public Td::ResultHandler {
|
||||
}
|
||||
}
|
||||
|
||||
vector<telegram_api::object_ptr<telegram_api::Reaction>> reactions;
|
||||
if (!reaction.empty()) {
|
||||
reactions.push_back(get_input_reaction(reaction));
|
||||
}
|
||||
|
||||
send_query(G()->net_query_creator().create(
|
||||
telegram_api::messages_sendReaction(flags, false /*ignored*/, false /*ignored*/, std::move(input_peer),
|
||||
full_message_id.get_message_id().get_server_message_id().get(),
|
||||
std::move(reactions)),
|
||||
transform(reactions, get_input_reaction)),
|
||||
{{dialog_id_}, {full_message_id}}));
|
||||
}
|
||||
|
||||
@ -697,10 +692,10 @@ void reload_message_reactions(Td *td, DialogId dialog_id, vector<MessageId> &&me
|
||||
td->create_handler<GetMessagesReactionsQuery>()->send(dialog_id, std::move(message_ids));
|
||||
}
|
||||
|
||||
void set_message_reaction(Td *td, FullMessageId full_message_id, string reaction, bool is_big, bool add_to_recent,
|
||||
Promise<Unit> &&promise) {
|
||||
void send_message_reaction(Td *td, FullMessageId full_message_id, vector<string> reactions, bool is_big,
|
||||
bool add_to_recent, Promise<Unit> &&promise) {
|
||||
td->create_handler<SendReactionQuery>(std::move(promise))
|
||||
->send(full_message_id, std::move(reaction), is_big, add_to_recent);
|
||||
->send(full_message_id, std::move(reactions), is_big, add_to_recent);
|
||||
}
|
||||
|
||||
void get_message_added_reactions(Td *td, FullMessageId full_message_id, string reaction, string offset, int32 limit,
|
||||
|
@ -185,8 +185,8 @@ bool is_active_reaction(const string &reaction, const FlatHashMap<string, size_t
|
||||
|
||||
void reload_message_reactions(Td *td, DialogId dialog_id, vector<MessageId> &&message_ids);
|
||||
|
||||
void set_message_reaction(Td *td, FullMessageId full_message_id, string reaction, bool is_big, bool add_to_recent,
|
||||
Promise<Unit> &&promise);
|
||||
void send_message_reaction(Td *td, FullMessageId full_message_id, vector<string> reactions, bool is_big,
|
||||
bool add_to_recent, Promise<Unit> &&promise);
|
||||
|
||||
void get_message_added_reactions(Td *td, FullMessageId full_message_id, string reaction, string offset, int32 limit,
|
||||
Promise<td_api::object_ptr<td_api::addedReactions>> &&promise);
|
||||
|
@ -24569,7 +24569,7 @@ void MessagesManager::add_message_reaction(FullMessageId full_message_id, string
|
||||
m->reactions->reactions_.emplace_back(reaction, 1, true, std::move(recent_chooser_dialog_ids), Auto());
|
||||
}
|
||||
|
||||
set_message_reactions(d, m, reaction, is_big, add_to_recent, std::move(promise));
|
||||
set_message_reactions(d, m, is_big, add_to_recent, std::move(promise));
|
||||
}
|
||||
|
||||
void MessagesManager::remove_message_reaction(FullMessageId full_message_id, string reaction, Promise<Unit> &&promise) {
|
||||
@ -24612,18 +24612,24 @@ void MessagesManager::remove_message_reaction(FullMessageId full_message_id, str
|
||||
return promise.set_value(Unit());
|
||||
}
|
||||
|
||||
set_message_reactions(d, m, reaction, false, false, std::move(promise));
|
||||
set_message_reactions(d, m, false, false, std::move(promise));
|
||||
}
|
||||
|
||||
void MessagesManager::set_message_reactions(Dialog *d, Message *m, string reaction, bool is_big, bool add_to_recent,
|
||||
void MessagesManager::set_message_reactions(Dialog *d, Message *m, bool is_big, bool add_to_recent,
|
||||
Promise<Unit> &&promise) {
|
||||
CHECK(m->reactions != nullptr);
|
||||
m->reactions->sort_reactions(active_reaction_pos_);
|
||||
|
||||
vector<string> reactions;
|
||||
for (auto &reaction : m->reactions->reactions_) {
|
||||
if (reaction.is_chosen()) {
|
||||
reactions.push_back(reaction.get_reaction());
|
||||
}
|
||||
}
|
||||
|
||||
FullMessageId full_message_id{d->dialog_id, m->message_id};
|
||||
pending_reactions_[full_message_id].query_count++;
|
||||
|
||||
m->reactions->sort_reactions(active_reaction_pos_);
|
||||
|
||||
send_update_message_interaction_info(d->dialog_id, m);
|
||||
on_message_changed(d, m, true, "set_message_reactions");
|
||||
|
||||
@ -24633,8 +24639,7 @@ void MessagesManager::set_message_reactions(Dialog *d, Message *m, string reacti
|
||||
send_closure(actor_id, &MessagesManager::on_set_message_reactions, full_message_id, std::move(result),
|
||||
std::move(promise));
|
||||
});
|
||||
::td::set_message_reaction(td_, full_message_id, std::move(reaction), is_big, add_to_recent,
|
||||
std::move(query_promise));
|
||||
send_message_reaction(td_, full_message_id, std::move(reactions), is_big, add_to_recent, std::move(query_promise));
|
||||
}
|
||||
|
||||
void MessagesManager::on_set_message_reactions(FullMessageId full_message_id, Result<Unit> result,
|
||||
|
@ -2691,8 +2691,7 @@ class MessagesManager final : public Actor {
|
||||
|
||||
ChatReactions get_message_available_reactions(const Dialog *d, const Message *m);
|
||||
|
||||
void set_message_reactions(Dialog *d, Message *m, string reaction, bool is_big, bool add_to_recent,
|
||||
Promise<Unit> &&promise);
|
||||
void set_message_reactions(Dialog *d, Message *m, bool is_big, bool add_to_recent, Promise<Unit> &&promise);
|
||||
|
||||
void on_set_message_reactions(FullMessageId full_message_id, Result<Unit> result, Promise<Unit> promise);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user