2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Added ability to report chat photo and channel photo.

This commit is contained in:
23rd
2022-10-20 17:50:58 +03:00
committed by John Preston
parent f0177bc6cc
commit 6d3f9017fa
5 changed files with 48 additions and 9 deletions

View File

@@ -1034,11 +1034,28 @@ void OverlayWidget::fillContextMenuActions(const MenuCallback &addAction) {
}, &st::mediaMenuIconProfile);
}();
[&] { // Report userpic.
if (!_peer
|| !_photo
|| _peer->isSelf()
|| _peer->isNotificationsUser()
|| !userPhotosKey()) {
if (!_peer || !_photo ) {
return;
}
using Type = SharedMediaType;
if (userPhotosKey()) {
if (_peer->isSelf() || _peer->isNotificationsUser()) {
return;
}
} else if ((sharedMediaType().value_or(Type::File) == Type::ChatPhoto)
|| (_peer->userpicPhotoId() == _photo->id)) {
if (const auto chat = _peer->asChat()) {
if (chat->canEditInformation()) {
return;
}
} else if (const auto channel = _peer->asChannel()) {
if (channel->canEditInformation()) {
return;
}
} else {
return;
}
} else {
return;
}
const auto photo = _photo;