Fix check_dialog_username.

GitOrigin-RevId: 47dd0a62c10f0bc8e91748f8197676f7b72aab2e
This commit is contained in:
levlam 2018-07-10 16:56:37 +03:00
parent 608ff3f45a
commit 8501dbedf8
3 changed files with 5 additions and 9 deletions

View File

@ -3190,7 +3190,7 @@ void ContactsManager::check_dialog_username(DialogId dialog_id, const string &us
if (error.message() == "USERNAME_INVALID") { if (error.message() == "USERNAME_INVALID") {
return promise.set_value(CheckDialogUsernameResult::Invalid); return promise.set_value(CheckDialogUsernameResult::Invalid);
} }
promise.set_error(std::move(error)); return promise.set_error(std::move(error));
} }
promise.set_value(result.ok() ? CheckDialogUsernameResult::Ok : CheckDialogUsernameResult::Occupied); promise.set_value(result.ok() ? CheckDialogUsernameResult::Ok : CheckDialogUsernameResult::Occupied);

View File

@ -307,8 +307,7 @@ void PasswordManager::update_password_settings(UpdateSettings update_settings, P
auto result_promise = PromiseCreator::lambda( auto result_promise = PromiseCreator::lambda(
[actor_id = actor_id(this), promise = std::move(promise)](Result<bool> r_update_settings) mutable { [actor_id = actor_id(this), promise = std::move(promise)](Result<bool> r_update_settings) mutable {
if (r_update_settings.is_error()) { if (r_update_settings.is_error()) {
promise.set_error(r_update_settings.move_as_error()); return promise.set_error(r_update_settings.move_as_error());
return;
} }
if (!r_update_settings.ok()) { if (!r_update_settings.ok()) {
promise.set_error(Status::Error(5, "account_updatePasswordSettings returned false")); promise.set_error(Status::Error(5, "account_updatePasswordSettings returned false"));
@ -323,8 +322,7 @@ void PasswordManager::update_password_settings(UpdateSettings update_settings, P
PromiseCreator::lambda([=, actor_id = actor_id(this), result_promise = std::move(result_promise), PromiseCreator::lambda([=, actor_id = actor_id(this), result_promise = std::move(result_promise),
update_settings = std::move(update_settings)](Result<PasswordFullState> r_state) mutable { update_settings = std::move(update_settings)](Result<PasswordFullState> r_state) mutable {
if (r_state.is_error()) { if (r_state.is_error()) {
result_promise.set_error(r_state.move_as_error()); return result_promise.set_error(r_state.move_as_error());
return;
} }
send_closure(actor_id, &PasswordManager::do_update_password_settings, std::move(update_settings), send_closure(actor_id, &PasswordManager::do_update_password_settings, std::move(update_settings),
r_state.move_as_ok(), std::move(result_promise)); r_state.move_as_ok(), std::move(result_promise));
@ -420,8 +418,7 @@ void PasswordManager::do_update_password_settings(UpdateSettings update_settings
void PasswordManager::get_state(Promise<State> promise) { void PasswordManager::get_state(Promise<State> promise) {
do_get_state(PromiseCreator::lambda([promise = std::move(promise)](Result<PasswordState> r_state) mutable { do_get_state(PromiseCreator::lambda([promise = std::move(promise)](Result<PasswordState> r_state) mutable {
if (r_state.is_error()) { if (r_state.is_error()) {
promise.set_error(r_state.move_as_error()); return promise.set_error(r_state.move_as_error());
return;
} }
promise.set_value(r_state.move_as_ok().as_td_api()); promise.set_value(r_state.move_as_ok().as_td_api());
})); }));

View File

@ -4706,8 +4706,7 @@ void Td::on_request(uint64 id, td_api::getRemoteFile &request) {
auto r_file_id = file_manager_->from_persistent_id( auto r_file_id = file_manager_->from_persistent_id(
request.remote_file_id_, request.file_type_ == nullptr ? FileType::Temp : from_td_api(*request.file_type_)); request.remote_file_id_, request.file_type_ == nullptr ? FileType::Temp : from_td_api(*request.file_type_));
if (r_file_id.is_error()) { if (r_file_id.is_error()) {
auto error = r_file_id.move_as_error(); send_closure(actor_id(this), &Td::send_error, id, r_file_id.move_as_error());
send_closure(actor_id(this), &Td::send_error, id, std::move(error));
} else { } else {
send_closure(actor_id(this), &Td::send_result, id, file_manager_->get_file_object(r_file_id.ok())); send_closure(actor_id(this), &Td::send_result, id, file_manager_->get_file_object(r_file_id.ok()));
} }