Replace empty first_name with phone_number.

GitOrigin-RevId: 3d19463a84d1aa074446382ff61e54f3f23563e1
This commit is contained in:
levlam 2018-02-26 20:52:17 +03:00
parent b5f695de80
commit 57a6071c0f

View File

@ -2446,6 +2446,9 @@ void ContactsManager::User::parse(ParserT &parser) {
if (has_language_code) {
parse(language_code, parser);
}
if (first_name.empty()) {
first_name = phone_number;
}
}
template <class StorerT>
@ -6335,6 +6338,9 @@ void ContactsManager::on_update_user_name(UserId user_id, string &&first_name, s
void ContactsManager::on_update_user_name(User *u, UserId user_id, string &&first_name, string &&last_name,
string &&username) {
if (first_name.empty()) {
first_name = u->phone_number;
}
if (u->first_name != first_name || u->last_name != last_name) {
u->first_name = std::move(first_name);
u->last_name = std::move(last_name);