diff --git a/td/telegram/ConfigManager.cpp b/td/telegram/ConfigManager.cpp index 7a1cc62b3..f85169ef2 100644 --- a/td/telegram/ConfigManager.cpp +++ b/td/telegram/ConfigManager.cpp @@ -1130,12 +1130,6 @@ void ConfigManager::do_set_archive_and_mute(bool archive_and_mute) { G()->shared_config().set_option_boolean("archive_and_mute_new_chats_from_unknown_users", archive_and_mute); } -td_api::object_ptr ConfigManager::get_update_suggested_actions( - const vector &added_actions, const vector &removed_actions) { - return td_api::make_object(transform(added_actions, get_suggested_action_object), - transform(removed_actions, get_suggested_action_object)); -} - void ConfigManager::dismiss_suggested_action(SuggestedAction suggested_action, Promise &&promise) { if (suggested_action == SuggestedAction::Empty) { return promise.set_error(Status::Error(400, "Action must be non-empty")); @@ -1162,7 +1156,7 @@ void ConfigManager::dismiss_suggested_action(SuggestedAction suggested_action, P void ConfigManager::do_dismiss_suggested_action(SuggestedAction suggested_action) { if (td::remove(suggested_actions_, suggested_action)) { - send_closure(G()->td(), &Td::send_update, get_update_suggested_actions({}, {suggested_action})); + send_closure(G()->td(), &Td::send_update, get_update_suggested_actions_object({}, {suggested_action})); } } @@ -1809,14 +1803,14 @@ void ConfigManager::process_app_config(tl_object_ptr &c CHECK(!added_actions.empty() || !removed_actions.empty()); suggested_actions_ = std::move(suggested_actions); send_closure(G()->td(), &Td::send_update, - get_update_suggested_actions(std::move(added_actions), std::move(removed_actions))); + get_update_suggested_actions_object(std::move(added_actions), std::move(removed_actions))); } } } void ConfigManager::get_current_state(vector> &updates) const { if (!suggested_actions_.empty()) { - updates.push_back(get_update_suggested_actions(suggested_actions_, {})); + updates.push_back(get_update_suggested_actions_object(suggested_actions_, {})); } } diff --git a/td/telegram/ConfigManager.h b/td/telegram/ConfigManager.h index 57f4a72a6..6ff759a16 100644 --- a/td/telegram/ConfigManager.h +++ b/td/telegram/ConfigManager.h @@ -157,9 +157,6 @@ class ConfigManager : public NetQueryCallback { void do_set_archive_and_mute(bool archive_and_mute); - static td_api::object_ptr get_update_suggested_actions( - const vector &added_actions, const vector &removed_actions); - void do_dismiss_suggested_action(SuggestedAction suggested_action); static Timestamp load_config_expire_time(); diff --git a/td/telegram/SuggestedAction.cpp b/td/telegram/SuggestedAction.cpp index 93c892997..bfc68f178 100644 --- a/td/telegram/SuggestedAction.cpp +++ b/td/telegram/SuggestedAction.cpp @@ -6,6 +6,8 @@ // #include "td/telegram/SuggestedAction.h" +#include "td/utils/algorithm.h" + namespace td { SuggestedAction get_suggested_action(Slice action_str) { @@ -62,4 +64,10 @@ td_api::object_ptr get_suggested_action_object(Suggeste } } +td_api::object_ptr get_update_suggested_actions_object( + const vector &added_actions, const vector &removed_actions) { + return td_api::make_object(transform(added_actions, get_suggested_action_object), + transform(removed_actions, get_suggested_action_object)); +} + } // namespace td diff --git a/td/telegram/SuggestedAction.h b/td/telegram/SuggestedAction.h index 13607948a..5f08daa24 100644 --- a/td/telegram/SuggestedAction.h +++ b/td/telegram/SuggestedAction.h @@ -23,4 +23,7 @@ SuggestedAction get_suggested_action(const td_api::object_ptr get_suggested_action_object(SuggestedAction action); +td_api::object_ptr get_update_suggested_actions_object( + const vector &added_actions, const vector &removed_actions); + } // namespace td