Remove chosen reaction when it is again.

This commit is contained in:
levlam 2022-01-26 11:02:20 +03:00
parent 893b9c4b6f
commit 9eb3a9a403
2 changed files with 3 additions and 2 deletions

View File

@ -4601,7 +4601,7 @@ editMessageSchedulingState chat_id:int53 message_id:int53 scheduling_state:Messa
//@description Changes chosen reaction for a message //@description Changes chosen reaction for a message
//@chat_id Identifier of the chat to which the message belongs //@chat_id Identifier of the chat to which the message belongs
//@message_id Identifier of the message //@message_id Identifier of the message
//@reaction Text representation of the chosen reaction, or an empty string to remove reaction //@reaction Text representation of the chosen reaction. Can be an empty string or the currently chosen reaction to remove the reaction
setMessageReaction chat_id:int53 message_id:int53 reaction:string = Ok; setMessageReaction chat_id:int53 message_id:int53 reaction:string = Ok;
//@description Returns reactions chosen for a message, along with their source //@description Returns reactions chosen for a message, along with their source

View File

@ -23755,7 +23755,8 @@ void MessagesManager::set_message_reaction(FullMessageId full_message_id, string
auto &message_reaction = *it; auto &message_reaction = *it;
if (message_reaction.is_chosen()) { if (message_reaction.is_chosen()) {
if (message_reaction.get_reaction() == reaction) { if (message_reaction.get_reaction() == reaction) {
return promise.set_value(Unit()); // double set removes reaction
reaction = string();
} }
message_reaction.set_is_chosen(false); message_reaction.set_is_chosen(false);
if (message_reaction.is_empty()) { if (message_reaction.is_empty()) {