From e65dddef7e632a7b4536820bf379bd35c6d52f54 Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 31 Mar 2020 02:46:04 +0300 Subject: [PATCH] Apply pending profile photo before getting full list of photos. GitOrigin-RevId: e03d728b9ba9012662c819fce24dca591b659f41 --- td/telegram/ContactsManager.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 5fadd288..325801f2 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -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> 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"));