From 5519bb352331101ccc418dd0f9a2e523c045b5aa Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 24 Jun 2021 17:25:10 +0400 Subject: [PATCH] Allow reporting private groups as well. Fixes #7451. --- Telegram/Resources/langs/lang.strings | 1 + Telegram/SourceFiles/mainwidget.cpp | 5 ++++- .../SourceFiles/window/window_peer_menu.cpp | 17 +++++++++++------ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index b2e4ec099..629dd54d8 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -1007,6 +1007,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_report_group_title" = "Report group"; "lng_report_bot_title" = "Report bot"; "lng_report_message_title" = "Report message"; +"lng_report_please_select_messages" = "Please select messages to report."; "lng_report_select_messages" = "Select messages"; "lng_report_messages_none" = "Select Messages"; "lng_report_messages_count#one" = "Report {count} Message"; diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 756cc7dca..072df8ecb 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -35,7 +35,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/special_buttons.h" #include "ui/widgets/buttons.h" #include "ui/widgets/shadow.h" -#include "ui/toast/toast.h" +#include "ui/toasts/common_toasts.h" #include "ui/widgets/dropdown_menu.h" #include "ui/image/image.h" #include "ui/focus_persister.h" @@ -1423,6 +1423,9 @@ void MainWidget::showChooseReportMessages( peer->id, SectionShow::Way::Forward, ShowForChooseMessagesMsgId); + Ui::ShowMultilineToast({ + .text = { tr::lng_report_please_select_messages(tr::now) }, + }); } void MainWidget::clearChooseReportMessages() { diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index 6412cd920..6bc4deae8 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -507,18 +507,18 @@ void Filler::addUserActions(not_null user) { } void Filler::addChatActions(not_null chat) { + const auto navigation = _controller; if (_request.section != Section::ChatsList) { - const auto controller = _controller; if (EditPeerInfoBox::Available(chat)) { const auto text = tr::lng_manage_group_title(tr::now); _addAction(text, [=] { - controller->showEditPeerBox(chat); + navigation->showEditPeerBox(chat); }); } if (chat->canAddMembers()) { _addAction( tr::lng_channel_add_members(tr::now), - [=] { AddChatMembers(controller, chat); }); + [=] { AddChatMembers(navigation, chat); }); } addPollAction(chat); if (chat->canExportChatHistory()) { @@ -533,6 +533,13 @@ void Filler::addChatActions(not_null chat) { _addAction( tr::lng_profile_clear_history(tr::now), ClearHistoryHandler(_peer)); + if (_request.section != Section::ChatsList) { + if (!chat->amCreator()) { + _addAction(tr::lng_profile_report(tr::now), [=] { + HistoryView::ShowReportPeerBox(navigation, chat); + }); + } + } } void Filler::addChannelActions(not_null channel) { @@ -597,9 +604,7 @@ void Filler::addChannelActions(not_null channel) { [=] { channel->session().api().joinChannel(channel); }); } if (_request.section != Section::ChatsList) { - const auto needReport = !channel->amCreator() - && (!isGroup || channel->isPublic()); - if (needReport) { + if (!channel->amCreator()) { _addAction(tr::lng_profile_report(tr::now), [=] { HistoryView::ShowReportPeerBox(navigation, channel); });