From 8cfa7229669801dc509e98e511b389b21d70f9fc Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 22 Dec 2025 14:19:34 +0300 Subject: [PATCH] Fixed local storage of user photos when self userpic was deleted. --- Telegram/SourceFiles/api/api_peer_photo.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Telegram/SourceFiles/api/api_peer_photo.cpp b/Telegram/SourceFiles/api/api_peer_photo.cpp index e333565aa0..00c3a28309 100644 --- a/Telegram/SourceFiles/api/api_peer_photo.cpp +++ b/Telegram/SourceFiles/api/api_peer_photo.cpp @@ -243,12 +243,16 @@ void PeerPhoto::suggest(not_null peer, UserPhoto &&photo) { void PeerPhoto::clear(not_null photo) { const auto self = _session->user(); if (self->userpicPhotoId() == photo->id) { + const auto photoId = photo->id; + const auto peerId = self->id; _api.request(MTPphotos_UpdateProfilePhoto( MTP_flags(0), MTPInputUser(), // bot MTP_inputPhotoEmpty() )).done([=](const MTPphotos_Photo &result) { self->setPhoto(MTP_userProfilePhotoEmpty()); + _session->storage().remove( + Storage::UserPhotosRemoveOne(peerToUser(peerId), photoId)); }).send(); } else if (photo->peer && photo->peer->userpicPhotoId() == photo->id) { const auto applier = [=](const MTPUpdates &result) {