diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index fdf645cbe..b3eb9e252 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -1304,6 +1304,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_report_message_title" = "Report message"; "lng_report_profile_photo_title" = "Report profile photo"; "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_select_messages" = "Select messages"; "lng_report_messages_none" = "Select Messages"; diff --git a/Telegram/SourceFiles/boxes/report_messages_box.cpp b/Telegram/SourceFiles/boxes/report_messages_box.cpp index 01836105f..73223c1fd 100644 --- a/Telegram/SourceFiles/boxes/report_messages_box.cpp +++ b/Telegram/SourceFiles/boxes/report_messages_box.cpp @@ -22,10 +22,18 @@ namespace { std::variant> data) { const auto source = v::match(data, [](const MessageIdsList &ids) { return Ui::ReportSource::Message; - }, [](not_null photo) { - return photo->hasVideo() - ? Ui::ReportSource::ProfileVideo - : Ui::ReportSource::ProfilePhoto; + }, [&](not_null photo) { + return peer->isUser() + ? (photo->hasVideo() + ? 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) { Unexpected("Bad source report."); return Ui::ReportSource::Bot; diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp index f20f0bf7e..5b75dec19 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp +++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp @@ -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; diff --git a/Telegram/SourceFiles/ui/boxes/report_box.cpp b/Telegram/SourceFiles/ui/boxes/report_box.cpp index 8dbe0f87a..97fd61120 100644 --- a/Telegram/SourceFiles/ui/boxes/report_box.cpp +++ b/Telegram/SourceFiles/ui/boxes/report_box.cpp @@ -44,6 +44,12 @@ void ReportReasonBox( return tr::lng_report_profile_photo_title(); case Source::ProfileVideo: 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."); }()); diff --git a/Telegram/SourceFiles/ui/boxes/report_box.h b/Telegram/SourceFiles/ui/boxes/report_box.h index 691ecd4a1..61d17e612 100644 --- a/Telegram/SourceFiles/ui/boxes/report_box.h +++ b/Telegram/SourceFiles/ui/boxes/report_box.h @@ -18,6 +18,10 @@ enum class ReportSource { Bot, ProfilePhoto, ProfileVideo, + GroupPhoto, + GroupVideo, + ChannelPhoto, + ChannelVideo, }; enum class ReportReason {