Drop username if it is invalid.

This commit is contained in:
levlam 2024-03-03 00:41:09 +03:00
parent d809329044
commit 6399c64252

View File

@ -1926,7 +1926,7 @@ void DialogManager::on_resolved_username(const string &username, Result<DialogId
resolve_dialog_username_queries_.erase(it); resolve_dialog_username_queries_.erase(it);
if (r_dialog_id.is_error()) { if (r_dialog_id.is_error()) {
auto error_message = r_dialog_id.error().message(); auto error_message = r_dialog_id.error().message();
if (error_message == Slice("USERNAME_NOT_OCCUPIED")) { if (error_message == Slice("USERNAME_NOT_OCCUPIED") || error_message == Slice("USERNAME_INVALID")) {
drop_username(username); drop_username(username);
} }
return fail_promises(promises, r_dialog_id.move_as_error()); return fail_promises(promises, r_dialog_id.move_as_error());