Fix userpic removing.

Regression was introduced in 68009b6fba.

Fixes #4152.
This commit is contained in:
John Preston 2017-12-12 15:45:40 +04:00
parent 3c101b0a50
commit 05e3ddce0c
2 changed files with 19 additions and 6 deletions

View file

@ -277,12 +277,7 @@ void PeerData::updateUserpic(
const auto size = kUserpicSize;
const auto loc = StorageImageLocation::FromMTP(size, size, location);
const auto photo = loc.isNull() ? ImagePtr() : ImagePtr(loc);
if (_userpicPhotoId != photoId
|| _userpic.v() != photo.v()
|| _userpicLocation != loc) {
setUserpic(photoId, loc, photo);
Notify::peerUpdatedDelayed(this, UpdateFlag::PhotoChanged);
}
setUserpicChecked(photoId, loc, photo);
}
void PeerData::clearUserpic() {
@ -300,6 +295,19 @@ void PeerData::clearUserpic() {
}
return ImagePtr();
}();
setUserpicChecked(photoId, loc, photo);
}
void PeerData::setUserpicChecked(
PhotoId photoId,
const StorageImageLocation &location,
ImagePtr userpic) {
if (_userpicPhotoId != photoId
|| _userpic.v() != userpic.v()
|| _userpicLocation != location) {
setUserpic(photoId, location, userpic);
Notify::peerUpdatedDelayed(this, UpdateFlag::PhotoChanged);
}
}
void PeerData::fillNames() {

View file

@ -238,6 +238,11 @@ private:
std::unique_ptr<Ui::EmptyUserpic> createEmptyUserpic() const;
void refreshEmptyUserpic() const;
void setUserpicChecked(
PhotoId photoId,
const StorageImageLocation &location,
ImagePtr userpic);
static constexpr auto kUnknownPhotoId = PhotoId(0xFFFFFFFFFFFFFFFFULL);
ImagePtr _userpic;