Allow to specify report text for all report chat reasons.
This commit is contained in:
parent
c1a14d887b
commit
65d4229352
@ -2932,8 +2932,8 @@ chatReportReasonUnrelatedLocation = ChatReportReason;
|
||||
//@description The chat represents a fake account
|
||||
chatReportReasonFake = ChatReportReason;
|
||||
|
||||
//@description A custom reason provided by the user @text Report text
|
||||
chatReportReasonCustom text:string = ChatReportReason;
|
||||
//@description A custom reason provided by the user
|
||||
chatReportReasonCustom = ChatReportReason;
|
||||
|
||||
|
||||
//@description Contains an HTTPS link to a message in a supergroup or channel @link Message link @is_public True, if the link will work for non-members of the chat
|
||||
@ -4914,8 +4914,9 @@ deleteAccount reason:string = Ok;
|
||||
//@description Removes a chat action bar without any other action @chat_id Chat identifier
|
||||
removeChatActionBar chat_id:int53 = Ok;
|
||||
|
||||
//@description Reports a chat to the Telegram moderators. A chat can be reported only from the chat action bar, or if this is a private chat with a bot, a private chat with a user sharing their location, a supergroup, or a channel, since other chats can't be checked by moderators @chat_id Chat identifier @reason The reason for reporting the chat @message_ids Identifiers of reported messages, if any
|
||||
reportChat chat_id:int53 reason:ChatReportReason message_ids:vector<int53> = Ok;
|
||||
//@description Reports a chat to the Telegram moderators. A chat can be reported only from the chat action bar, or if this is a private chat with a bot, a private chat with a user sharing their location, a supergroup, or a channel, since other chats can't be checked by moderators
|
||||
//@chat_id Chat identifier @reason The reason for reporting the chat @message_ids Identifiers of reported messages, if any @text Additional report details; 0-1024 characters
|
||||
reportChat chat_id:int53 reason:ChatReportReason message_ids:vector<int53> text:string = Ok;
|
||||
|
||||
|
||||
//@description Returns an HTTP URL with the chat statistics. Currently this method of getting the statistics are disabled and can be deleted in the future @chat_id Chat identifier @parameters Parameters from "tg://statsrefresh?params=******" link @is_dark Pass true if a URL with the dark theme must be returned
|
||||
|
Binary file not shown.
@ -4389,7 +4389,7 @@ class ReportPeerQuery : public Td::ResultHandler {
|
||||
}
|
||||
|
||||
void send(DialogId dialog_id, tl_object_ptr<telegram_api::ReportReason> &&report_reason,
|
||||
const vector<MessageId> &message_ids) {
|
||||
const vector<MessageId> &message_ids, const string &message) {
|
||||
dialog_id_ = dialog_id;
|
||||
|
||||
auto input_peer = td->messages_manager_->get_input_peer(dialog_id, AccessRights::Read);
|
||||
@ -4397,11 +4397,11 @@ class ReportPeerQuery : public Td::ResultHandler {
|
||||
|
||||
if (message_ids.empty()) {
|
||||
send_query(G()->net_query_creator().create(
|
||||
telegram_api::account_reportPeer(std::move(input_peer), std::move(report_reason), string())));
|
||||
telegram_api::account_reportPeer(std::move(input_peer), std::move(report_reason), message)));
|
||||
} else {
|
||||
send_query(G()->net_query_creator().create(
|
||||
telegram_api::messages_report(std::move(input_peer), MessagesManager::get_server_message_ids(message_ids),
|
||||
std::move(report_reason), string())));
|
||||
std::move(report_reason), message)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -8169,7 +8169,8 @@ bool MessagesManager::can_report_dialog(DialogId dialog_id) const {
|
||||
}
|
||||
|
||||
void MessagesManager::report_dialog(DialogId dialog_id, const tl_object_ptr<td_api::ChatReportReason> &reason,
|
||||
const vector<MessageId> &message_ids, Promise<Unit> &&promise) {
|
||||
const vector<MessageId> &message_ids, const string &message,
|
||||
Promise<Unit> &&promise) {
|
||||
Dialog *d = get_dialog_force(dialog_id);
|
||||
if (d == nullptr) {
|
||||
return promise.set_error(Status::Error(3, "Chat not found"));
|
||||
@ -8251,23 +8252,16 @@ void MessagesManager::report_dialog(DialogId dialog_id, const tl_object_ptr<td_a
|
||||
hide_dialog_action_bar(d);
|
||||
}
|
||||
break;
|
||||
case td_api::chatReportReasonCustom::ID: {
|
||||
auto other_reason = static_cast<const td_api::chatReportReasonCustom *>(reason.get());
|
||||
auto text = other_reason->text_;
|
||||
if (!clean_input_string(text)) {
|
||||
return promise.set_error(Status::Error(400, "Text must be encoded in UTF-8"));
|
||||
}
|
||||
|
||||
case td_api::chatReportReasonCustom::ID:
|
||||
report_reason = make_tl_object<telegram_api::inputReportReasonOther>();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
CHECK(report_reason != nullptr);
|
||||
|
||||
td_->create_handler<ReportPeerQuery>(std::move(promise))
|
||||
->send(dialog_id, std::move(report_reason), server_message_ids);
|
||||
->send(dialog_id, std::move(report_reason), server_message_ids, message);
|
||||
}
|
||||
|
||||
void MessagesManager::on_get_peer_settings(DialogId dialog_id,
|
||||
|
@ -776,7 +776,7 @@ class MessagesManager : public Actor {
|
||||
void reget_dialog_action_bar(DialogId dialog_id, const char *source);
|
||||
|
||||
void report_dialog(DialogId dialog_id, const tl_object_ptr<td_api::ChatReportReason> &reason,
|
||||
const vector<MessageId> &message_ids, Promise<Unit> &&promise);
|
||||
const vector<MessageId> &message_ids, const string &message, Promise<Unit> &&promise);
|
||||
|
||||
void on_get_peer_settings(DialogId dialog_id, tl_object_ptr<telegram_api::peerSettings> &&peer_settings,
|
||||
bool ignore_privacy_exception = false);
|
||||
|
@ -6965,9 +6965,11 @@ void Td::on_request(uint64 id, const td_api::removeChatActionBar &request) {
|
||||
|
||||
void Td::on_request(uint64 id, td_api::reportChat &request) {
|
||||
CHECK_IS_USER();
|
||||
CLEAN_INPUT_STRING(request.text_);
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
messages_manager_->report_dialog(DialogId(request.chat_id_), request.reason_,
|
||||
MessagesManager::get_message_ids(request.message_ids_), std::move(promise));
|
||||
MessagesManager::get_message_ids(request.message_ids_), request.text_,
|
||||
std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::getChatStatisticsUrl &request) {
|
||||
|
@ -1338,7 +1338,7 @@ class CliClient final : public Actor {
|
||||
if (reason == "fake") {
|
||||
return td_api::make_object<td_api::chatReportReasonFake>();
|
||||
}
|
||||
return td_api::make_object<td_api::chatReportReasonCustom>(reason.str());
|
||||
return td_api::make_object<td_api::chatReportReasonCustom>();
|
||||
}
|
||||
|
||||
static td_api::object_ptr<td_api::NetworkType> get_network_type(MutableSlice type) {
|
||||
@ -3905,9 +3905,10 @@ class CliClient final : public Actor {
|
||||
string chat_id;
|
||||
string reason;
|
||||
string message_ids;
|
||||
get_args(args, chat_id, reason, message_ids);
|
||||
string text;
|
||||
get_args(args, chat_id, reason, message_ids, text);
|
||||
send_request(td_api::make_object<td_api::reportChat>(as_chat_id(chat_id), get_chat_report_reason(reason),
|
||||
as_message_ids(message_ids)));
|
||||
as_message_ids(message_ids), text));
|
||||
} else if (op == "gcsu") {
|
||||
string chat_id;
|
||||
string parameters;
|
||||
|
Loading…
Reference in New Issue
Block a user