Allow to set again the same big reaction.

This commit is contained in:
levlam 2022-02-03 13:47:18 +03:00
parent 9e96126b87
commit 877b5fce00
2 changed files with 12 additions and 13 deletions

View File

@ -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;

View File

@ -24135,24 +24135,23 @@ 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.is_empty()) {
it = m->reactions->reactions_.erase(it);
} else {
++it;
}
}
pending_reactions_[full_message_id].query_count++;