From c0944f6bdac1b83f9560713ce46b606bc77af4e3 Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 9 Jun 2018 02:00:15 +0300 Subject: [PATCH] Continue to load terms of service after they are accepted. GitOrigin-RevId: c7dadcea4bf8b61f3d428999e034572c67ef8b3f --- td/telegram/Td.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 9fafac11..5ebb42b7 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -6981,7 +6981,14 @@ void Td::on_request(uint64 id, td_api::removeRecentHashtag &request) { void Td::on_request(uint64 id, td_api::acceptTermsOfService &request) { CHECK_IS_USER(); CLEAN_INPUT_STRING(request.terms_of_service_id_); - CREATE_OK_REQUEST_PROMISE(promise); + auto promise = PromiseCreator::lambda([id = id, actor_id = actor_id(this)](Result<> result) mutable { + if (result.is_error()) { + send_closure(actor_id, &Td::send_error, id, result.move_as_error()); + } else { + send_closure(actor_id, &Td::send_result, id, td_api::make_object()); + send_closure(actor_id, &Td::schedule_get_terms_of_service, 0); + } + }); accept_terms_of_service(this, std::move(request.terms_of_service_id_), std::move(promise)); }