Apply pending profile photo before getting full list of photos.

GitOrigin-RevId: e03d728b9ba9012662c819fce24dca591b659f41
This commit is contained in:
levlam 2020-03-31 02:46:04 +03:00
parent 09f2dc8e9d
commit e65dddef7e

View File

@ -3807,11 +3807,13 @@ const DialogPhoto *ContactsManager::get_user_dialog_photo(UserId user_id) {
return nullptr;
}
auto it = pending_user_photos_.find(user_id);
if (it != pending_user_photos_.end()) {
do_update_user_photo(u, user_id, std::move(it->second), "get_user_dialog_photo");
pending_user_photos_.erase(it);
update_user(u, user_id);
if (!u->is_photo_inited) {
auto it = pending_user_photos_.find(user_id);
if (it != pending_user_photos_.end()) {
do_update_user_photo(u, user_id, std::move(it->second), "get_user_dialog_photo");
pending_user_photos_.erase(it);
update_user(u, user_id);
}
}
return &u->photo;
}
@ -11461,6 +11463,8 @@ std::pair<int32, vector<const Photo *>> ContactsManager::get_user_profile_photos
return result;
}
get_user_dialog_photo(user_id); // apply pending user photo
auto user_photos = &user_photos_[user_id];
if (user_photos->getting_now) {
promise.set_error(Status::Error(400, "Request for new profile photos has already been sent"));