Allow arbitrary reaction order in setChatAvailableReactions.

This commit is contained in:
levlam 2022-02-10 20:28:19 +03:00
parent 987e875520
commit 3d8e5e00e4
2 changed files with 4 additions and 2 deletions

View File

@ -4899,7 +4899,7 @@ toggleChatIsMarkedAsUnread chat_id:int53 is_marked_as_unread:Bool = Ok;
//@description Changes the value of the default disable_notification parameter, used when a message is sent to a chat @chat_id Chat identifier @default_disable_notification New value of default_disable_notification
toggleChatDefaultDisableNotification chat_id:int53 default_disable_notification:Bool = Ok;
//@description Changes reactions, available in a chat. Available for basic groups, supergroups, and channels. Requires can_change_info administrator right @chat_id Identifier of the chat @available_reactions New list of reactions, available in the chat. All reactions must be active and order of the reactions must be the same as in updateReactions
//@description Changes reactions, available in a chat. Available for basic groups, supergroups, and channels. Requires can_change_info administrator right @chat_id Identifier of the chat @available_reactions New list of reactions, available in the chat. All reactions must be active
setChatAvailableReactions chat_id:int53 available_reactions:vector<string> = Ok;
//@description Changes application-specific data associated with a chat @chat_id Chat identifier @client_data New value of client_data

View File

@ -33063,9 +33063,11 @@ void MessagesManager::set_dialog_available_reactions(DialogId dialog_id, vector<
return promise.set_error(Status::Error(400, "Chat not found"));
}
if (get_active_reactions(available_reactions) != available_reactions) {
auto active_reactions = get_active_reactions(available_reactions);
if (active_reactions.size() != available_reactions.size()) {
return promise.set_error(Status::Error(400, "Invalid reactions specified"));
}
available_reactions = std::move(active_reactions);
switch (dialog_id.get_type()) {
case DialogType::User: