From 3d8e5e00e45a1599be8bfa8c29a4d7f6f8e1c4b4 Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 10 Feb 2022 20:28:19 +0300 Subject: [PATCH] Allow arbitrary reaction order in setChatAvailableReactions. --- td/generate/scheme/td_api.tl | 2 +- td/telegram/MessagesManager.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 468b1b2bf..f5df5a82d 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -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 = Ok; //@description Changes application-specific data associated with a chat @chat_id Chat identifier @client_data New value of client_data diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index e5f8a74f9..b79ea4f83 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -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: