Fix user and chat flags handling.

This commit is contained in:
John Preston
2018-11-02 22:35:57 +04:00
parent 48548e9303
commit 75db59a8bb
2 changed files with 24 additions and 20 deletions
+8 -8
View File
@@ -172,13 +172,13 @@ void PeerData::setUserpic(
}
void PeerData::setUserpicPhoto(const MTPPhoto &data) {
auto photoId = [&]() -> PhotoId {
if (const auto photo = Auth().data().photo(data)) {
photo->peer = this;
return photo->id;
}
return 0;
}();
const auto photoId = data.match([&](const MTPDphoto &data) {
const auto photo = Auth().data().photo(data);
photo->peer = this;
return photo->id;
}, [](const MTPDphotoEmpty &data) {
return PhotoId(0);
});
if (_userpicPhotoId != photoId) {
_userpicPhotoId = photoId;
Notify::peerUpdatedDelayed(this, UpdateFlag::PhotoChanged);
@@ -332,7 +332,7 @@ void PeerData::setUserpicChecked(
bool PeerData::canPinMessages() const {
if (const auto user = asUser()) {
return user->isSelf();
return user->fullFlags() & MTPDuserFull::Flag::f_can_pin_message;
} else if (const auto chat = asChat()) {
return chat->adminsEnabled() ? chat->amAdmin() : chat->amIn();
} else if (const auto channel = asChannel()) {