From 74eb5d6ae4cc825057bd5c82e92de1a414189db0 Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 26 Dec 2022 21:40:04 +0300 Subject: [PATCH] Always send updates in ContactsManager::delete_my_profile_photo_from_cache. --- td/telegram/ContactsManager.cpp | 17 ++++++----------- td/telegram/ContactsManager.h | 2 +- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 52f7df12f..5a63767d4 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -13055,7 +13055,7 @@ void ContactsManager::on_set_profile_photo(UserId user_id, tl_object_ptrusers_), "on_set_profile_photo"); add_set_profile_photo_to_cache( @@ -13072,7 +13072,7 @@ void ContactsManager::on_set_profile_photo(UserId user_id, tl_object_ptr promise) { - bool need_reget_user = delete_my_profile_photo_from_cache(profile_photo_id, true); + bool need_reget_user = delete_my_profile_photo_from_cache(profile_photo_id); if (need_reget_user && !G()->close_flag()) { return reload_user(get_my_id(), std::move(promise)); } @@ -13172,7 +13172,7 @@ void ContactsManager::add_set_profile_photo_to_cache(UserId user_id, Photo &&pho } } -bool ContactsManager::delete_my_profile_photo_from_cache(int64 profile_photo_id, bool send_updates) { +bool ContactsManager::delete_my_profile_photo_from_cache(int64 profile_photo_id) { if (profile_photo_id == 0 || profile_photo_id == -2) { return false; } @@ -13180,8 +13180,7 @@ bool ContactsManager::delete_my_profile_photo_from_cache(int64 profile_photo_id, // we have subsequence of user photos in user_photos_ // ProfilePhoto in User and Photo in UserFull - LOG(INFO) << "Delete profile photo " << profile_photo_id << " from cache with" << (send_updates ? "" : "out") - << " updates"; + LOG(INFO) << "Delete profile photo " << profile_photo_id << " from cache"; auto user_id = get_my_id(); User *u = get_user_force(user_id); @@ -13225,9 +13224,7 @@ bool ContactsManager::delete_my_profile_photo_from_cache(int64 profile_photo_id, do_update_user_photo(u, user_id, ProfilePhoto(), false, "delete_my_profile_photo_from_cache 2"); need_reget_user = user_photos == nullptr || user_photos->count != 0; } - if (send_updates) { - update_user(u, user_id); - } + update_user(u, user_id); // update Photo in UserFull if (user_full != nullptr) { @@ -13257,9 +13254,7 @@ bool ContactsManager::delete_my_profile_photo_from_cache(int64 profile_photo_id, user_full->need_save_to_database = true; } reload_user_full(user_id, Auto()); - if (send_updates) { - update_user_full(user_full, user_id, "delete_my_profile_photo_from_cache"); - } + update_user_full(user_full, user_id, "delete_my_profile_photo_from_cache"); } } diff --git a/td/telegram/ContactsManager.h b/td/telegram/ContactsManager.h index 38371e6a9..5238698d8 100644 --- a/td/telegram/ContactsManager.h +++ b/td/telegram/ContactsManager.h @@ -1373,7 +1373,7 @@ class ContactsManager final : public Actor { UserPhotos *add_user_photos(UserId user_id); int64 get_user_full_profile_photo_id(const UserFull *user_full); void add_set_profile_photo_to_cache(UserId user_id, Photo &&photo, bool is_fallback); - bool delete_my_profile_photo_from_cache(int64 profile_photo_id, bool send_updates); + bool delete_my_profile_photo_from_cache(int64 profile_photo_id); void drop_user_full_photos(UserFull *user_full, UserId user_id, int64 expected_photo_id, const char *source); void drop_user_photos(UserId user_id, bool is_empty, const char *source); void drop_user_full(UserId user_id);