Immediately ignore user photo if it's identifier is still the same.
This commit is contained in:
parent
b41bb654e4
commit
6c5c26db7f
@ -13145,7 +13145,8 @@ void ContactsManager::on_update_user_phone_number(User *u, UserId user_id, strin
|
|||||||
|
|
||||||
void ContactsManager::on_update_user_photo(User *u, UserId user_id,
|
void ContactsManager::on_update_user_photo(User *u, UserId user_id,
|
||||||
tl_object_ptr<telegram_api::UserProfilePhoto> &&photo, const char *source) {
|
tl_object_ptr<telegram_api::UserProfilePhoto> &&photo, const char *source) {
|
||||||
if (td_->auth_manager_->is_bot() && !G()->use_chat_info_database() && !u->is_photo_inited) {
|
if (td_->auth_manager_->is_bot() && !G()->use_chat_info_database()) {
|
||||||
|
if (!u->is_photo_inited) {
|
||||||
if (photo != nullptr && photo->get_id() == telegram_api::userProfilePhoto::ID) {
|
if (photo != nullptr && photo->get_id() == telegram_api::userProfilePhoto::ID) {
|
||||||
auto *profile_photo = static_cast<telegram_api::userProfilePhoto *>(photo.get());
|
auto *profile_photo = static_cast<telegram_api::userProfilePhoto *>(photo.get());
|
||||||
if ((profile_photo->flags_ & telegram_api::userProfilePhoto::STRIPPED_THUMB_MASK) != 0) {
|
if ((profile_photo->flags_ & telegram_api::userProfilePhoto::STRIPPED_THUMB_MASK) != 0) {
|
||||||
@ -13169,6 +13170,13 @@ void ContactsManager::on_update_user_photo(User *u, UserId user_id,
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (u->is_received) {
|
||||||
|
auto new_photo_id = get_profile_photo_id(photo);
|
||||||
|
if (new_photo_id == u->photo.id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
do_update_user_photo(u, user_id, std::move(photo), source);
|
do_update_user_photo(u, user_id, std::move(photo), source);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user