Allow reporting private groups as well.

Fixes #7451.
This commit is contained in:
John Preston 2021-06-24 17:25:10 +04:00
parent ff213d1386
commit 5519bb3523
3 changed files with 16 additions and 7 deletions

View File

@ -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";

View File

@ -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() {

View File

@ -507,18 +507,18 @@ void Filler::addUserActions(not_null<UserData*> user) {
}
void Filler::addChatActions(not_null<ChatData*> 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<ChatData*> 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<ChannelData*> channel) {
@ -597,9 +604,7 @@ void Filler::addChannelActions(not_null<ChannelData*> 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);
});