diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 08ae17fa7..468b1b2bf 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -4626,7 +4626,7 @@ getMessageAvailableReactions chat_id:int53 message_id:int53 = AvailableReactions //@description Changes chosen reaction for a message //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message -//@reaction Text representation of the new chosen reaction. Can be an empty string or the currently chosen reaction to remove the reaction +//@reaction Text representation of the new chosen reaction. Can be an empty string or the currently chosen non-big reaction to remove the reaction //@is_big True, if the reaction is added with a big animation setMessageReaction chat_id:int53 message_id:int53 reaction:string is_big:Bool = Ok; diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 1e44d6312..229a644e1 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -24135,23 +24135,22 @@ void MessagesManager::set_message_reaction(FullMessageId full_message_id, string for (auto it = m->reactions->reactions_.begin(); it != m->reactions->reactions_.end();) { auto &message_reaction = *it; if (message_reaction.is_chosen()) { - if (message_reaction.get_reaction() == reaction) { - // double set removes reaction + if (message_reaction.get_reaction() == reaction && !is_big) { + // double set removes reaction, unless a big reaction is set reaction = string(); } message_reaction.set_is_chosen(false, get_my_dialog_id(), can_get_added_reactions); - if (message_reaction.is_empty()) { - it = m->reactions->reactions_.erase(it); - continue; - } - } else { - if (message_reaction.get_reaction() == reaction) { - message_reaction.set_is_chosen(true, get_my_dialog_id(), can_get_added_reactions); - is_found = true; - } + } + if (message_reaction.get_reaction() == reaction) { + message_reaction.set_is_chosen(true, get_my_dialog_id(), can_get_added_reactions); + is_found = true; } - ++it; + if (message_reaction.is_empty()) { + it = m->reactions->reactions_.erase(it); + } else { + ++it; + } } pending_reactions_[full_message_id].query_count++;