mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added ability to report chat photo and channel photo.
This commit is contained in:
parent
f0177bc6cc
commit
6d3f9017fa
5 changed files with 48 additions and 9 deletions
|
@ -1304,6 +1304,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_report_message_title" = "Report message";
|
"lng_report_message_title" = "Report message";
|
||||||
"lng_report_profile_photo_title" = "Report profile photo";
|
"lng_report_profile_photo_title" = "Report profile photo";
|
||||||
"lng_report_profile_video_title" = "Report profile video";
|
"lng_report_profile_video_title" = "Report profile video";
|
||||||
|
"lng_report_group_photo_title" = "Report group photo";
|
||||||
|
"lng_report_group_video_title" = "Report group video";
|
||||||
|
"lng_report_channel_photo_title" = "Report channel photo";
|
||||||
|
"lng_report_channel_video_title" = "Report channel video";
|
||||||
"lng_report_please_select_messages" = "Please select messages to report.";
|
"lng_report_please_select_messages" = "Please select messages to report.";
|
||||||
"lng_report_select_messages" = "Select messages";
|
"lng_report_select_messages" = "Select messages";
|
||||||
"lng_report_messages_none" = "Select Messages";
|
"lng_report_messages_none" = "Select Messages";
|
||||||
|
|
|
@ -22,10 +22,18 @@ namespace {
|
||||||
std::variant<v::null_t, MessageIdsList, not_null<PhotoData*>> data) {
|
std::variant<v::null_t, MessageIdsList, not_null<PhotoData*>> data) {
|
||||||
const auto source = v::match(data, [](const MessageIdsList &ids) {
|
const auto source = v::match(data, [](const MessageIdsList &ids) {
|
||||||
return Ui::ReportSource::Message;
|
return Ui::ReportSource::Message;
|
||||||
}, [](not_null<PhotoData*> photo) {
|
}, [&](not_null<PhotoData*> photo) {
|
||||||
return photo->hasVideo()
|
return peer->isUser()
|
||||||
? Ui::ReportSource::ProfileVideo
|
? (photo->hasVideo()
|
||||||
: Ui::ReportSource::ProfilePhoto;
|
? Ui::ReportSource::ProfileVideo
|
||||||
|
: Ui::ReportSource::ProfilePhoto)
|
||||||
|
: (peer->isChat() || (peer->isChannel() && peer->isMegagroup()))
|
||||||
|
? (photo->hasVideo()
|
||||||
|
? Ui::ReportSource::GroupVideo
|
||||||
|
: Ui::ReportSource::GroupPhoto)
|
||||||
|
: (photo->hasVideo()
|
||||||
|
? Ui::ReportSource::ChannelVideo
|
||||||
|
: Ui::ReportSource::ChannelPhoto);
|
||||||
}, [](v::null_t) {
|
}, [](v::null_t) {
|
||||||
Unexpected("Bad source report.");
|
Unexpected("Bad source report.");
|
||||||
return Ui::ReportSource::Bot;
|
return Ui::ReportSource::Bot;
|
||||||
|
|
|
@ -1034,11 +1034,28 @@ void OverlayWidget::fillContextMenuActions(const MenuCallback &addAction) {
|
||||||
}, &st::mediaMenuIconProfile);
|
}, &st::mediaMenuIconProfile);
|
||||||
}();
|
}();
|
||||||
[&] { // Report userpic.
|
[&] { // Report userpic.
|
||||||
if (!_peer
|
if (!_peer || !_photo ) {
|
||||||
|| !_photo
|
return;
|
||||||
|| _peer->isSelf()
|
}
|
||||||
|| _peer->isNotificationsUser()
|
using Type = SharedMediaType;
|
||||||
|| !userPhotosKey()) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
const auto photo = _photo;
|
const auto photo = _photo;
|
||||||
|
|
|
@ -44,6 +44,12 @@ void ReportReasonBox(
|
||||||
return tr::lng_report_profile_photo_title();
|
return tr::lng_report_profile_photo_title();
|
||||||
case Source::ProfileVideo:
|
case Source::ProfileVideo:
|
||||||
return tr::lng_report_profile_video_title();
|
return tr::lng_report_profile_video_title();
|
||||||
|
case Source::GroupPhoto: return tr::lng_report_group_photo_title();
|
||||||
|
case Source::GroupVideo: return tr::lng_report_group_video_title();
|
||||||
|
case Source::ChannelPhoto:
|
||||||
|
return tr::lng_report_channel_photo_title();
|
||||||
|
case Source::ChannelVideo:
|
||||||
|
return tr::lng_report_channel_video_title();
|
||||||
}
|
}
|
||||||
Unexpected("'source' in ReportReasonBox.");
|
Unexpected("'source' in ReportReasonBox.");
|
||||||
}());
|
}());
|
||||||
|
|
|
@ -18,6 +18,10 @@ enum class ReportSource {
|
||||||
Bot,
|
Bot,
|
||||||
ProfilePhoto,
|
ProfilePhoto,
|
||||||
ProfileVideo,
|
ProfileVideo,
|
||||||
|
GroupPhoto,
|
||||||
|
GroupVideo,
|
||||||
|
ChannelPhoto,
|
||||||
|
ChannelVideo,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class ReportReason {
|
enum class ReportReason {
|
||||||
|
|
Loading…
Add table
Reference in a new issue