Fixed local storage of user photos when previous userpic set as main.

This commit is contained in:
23rd
2025-12-22 15:04:39 +03:00
committed by John Preston
parent 06caf65a6a
commit 66645ce523

View File

@@ -318,15 +318,20 @@ void PeerPhoto::set(not_null<PeerData*> peer, not_null<PhotoData*> photo) {
return;
}
if (peer == _session->user()) {
const auto photoId = photo->id;
const auto peerId = peer->id;
_api.request(MTPphotos_UpdateProfilePhoto(
MTP_flags(0),
MTPInputUser(), // bot
photo->mtpInput()
)).done([=](const MTPphotos_Photo &result) {
result.match([&](const MTPDphotos_photo &data) {
_session->data().processPhoto(data.vphoto());
_session->data().processUsers(data.vusers());
});
const auto newPhoto = _session->data().processPhoto(
result.data().vphoto());
_session->data().processUsers(result.data().vusers());
_session->storage().replace(Storage::UserPhotosReplace(
peerToUser(peerId),
photoId,
newPhoto->id));
}).send();
} else {
const auto applier = [=](const MTPUpdates &result) {