Explicitly disallow removal of an empty reaction.

This commit is contained in:
levlam 2022-09-09 19:42:14 +03:00
parent 52fbb073fe
commit 345c930aa7

View File

@ -24566,6 +24566,10 @@ void MessagesManager::remove_message_reaction(FullMessageId full_message_id, str
return promise.set_error(Status::Error(400, "Message not found"));
}
if (reaction.empty()) {
return promise.set_error(Status::Error(400, "Invalid reaction specified"));
}
bool have_recent_choosers = !is_broadcast_channel(dialog_id) && !is_discussion_message(dialog_id, m);
if (m->reactions == nullptr || !m->reactions->remove_reaction(reaction, get_my_dialog_id(), have_recent_choosers)) {
return promise.set_value(Unit());