diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 707f680f0..4ed4259e5 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -2349,9 +2349,6 @@ connectedWebsite id:int64 domain_name:string bot_user_id:int32 browser:string pl connectedWebsites websites:vector = ConnectedWebsites; -//@description Contains information about the availability of the "Report spam" action for a chat @can_report_spam True, if a prompt with the "Report spam" action should be shown to the user -chatReportSpamState can_report_spam:Bool = ChatReportSpamState; - //@class ChatReportReason @description Describes the reason why a chat is reported //@description The chat contains spam messages @@ -3901,12 +3898,6 @@ getAccountTtl = AccountTtl; deleteAccount reason:string = Ok; -//@description Returns information on whether the current chat can be reported as spam @chat_id Chat identifier -getChatReportSpamState chat_id:int53 = ChatReportSpamState; - -//@description Reports to the server whether a chat is a spam chat or not. Can be used only if ChatReportSpamState.can_report_spam is true. After this request, ChatReportSpamState.can_report_spam becomes false forever @chat_id Chat identifier @is_spam_chat If true, the chat will be reported as spam; otherwise it will be marked as not spam -changeChatReportSpamState chat_id:int53 is_spam_chat:Bool = Ok; - //@description Removes a chat action bar without any other action @chat_id Chat identifier removeChatActionBar chat_id:int53 = Ok; diff --git a/td/generate/scheme/td_api.tlo b/td/generate/scheme/td_api.tlo index de23e5c20..627e57d65 100644 Binary files a/td/generate/scheme/td_api.tlo and b/td/generate/scheme/td_api.tlo differ diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index e951dd7ea..8cb55fb5e 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -3176,13 +3176,9 @@ class ResetNotifySettingsQuery : public Td::ResultHandler { }; class GetPeerSettingsQuery : public Td::ResultHandler { - Promise promise_; DialogId dialog_id_; public: - explicit GetPeerSettingsQuery(Promise &&promise) : promise_(std::move(promise)) { - } - void send(DialogId dialog_id) { dialog_id_ = dialog_id; @@ -3200,14 +3196,11 @@ class GetPeerSettingsQuery : public Td::ResultHandler { } td->messages_manager_->on_get_peer_settings(dialog_id_, result_ptr.move_as_ok()); - - promise_.set_value(Unit()); } void on_error(uint64 id, Status status) override { LOG(INFO) << "Receive error for get peer settings: " << status; td->messages_manager_->on_get_dialog_error(dialog_id_, status, "GetPeerSettingsQuery"); - promise_.set_error(std::move(status)); } }; @@ -6453,7 +6446,7 @@ void MessagesManager::repair_dialog_action_bar(DialogId dialog_id) { return; } - return td_->create_handler(Promise())->send(dialog_id); + return td_->create_handler()->send(dialog_id); case DialogType::SecretChat: case DialogType::None: default: @@ -6461,55 +6454,6 @@ void MessagesManager::repair_dialog_action_bar(DialogId dialog_id) { } } -bool MessagesManager::get_dialog_report_spam_state(DialogId dialog_id, Promise &&promise) { - Dialog *d = get_dialog_force(dialog_id); - if (d == nullptr) { - promise.set_error(Status::Error(3, "Chat not found")); - return false; - } - - if (d->know_can_report_spam) { - promise.set_value(Unit()); - return d->can_report_spam; - } - - switch (dialog_id.get_type()) { - case DialogType::User: - case DialogType::Chat: - case DialogType::Channel: - td_->create_handler(std::move(promise))->send(dialog_id); - return false; - case DialogType::SecretChat: - promise.set_value(Unit()); - return false; - case DialogType::None: - default: - UNREACHABLE(); - return false; - } -} - -void MessagesManager::change_dialog_report_spam_state(DialogId dialog_id, bool is_spam_dialog, - Promise &&promise) { - Dialog *d = get_dialog_force(dialog_id); - if (d == nullptr) { - return promise.set_error(Status::Error(3, "Chat not found")); - } - - if (!have_input_peer(dialog_id, AccessRights::Read)) { - return promise.set_error(Status::Error(3, "Can't access the chat")); - } - - if (!d->know_can_report_spam || !d->can_report_spam) { - return promise.set_error(Status::Error(3, "Can't update chat report spam state")); - } - - d->can_report_spam = false; - on_dialog_updated(dialog_id, "change_dialog_report_spam_state"); - - change_dialog_report_spam_state_on_server(dialog_id, is_spam_dialog, 0, std::move(promise)); -} - void MessagesManager::remove_dialog_action_bar(DialogId dialog_id, Promise &&promise) { Dialog *d = get_dialog_force(dialog_id); if (d == nullptr) { diff --git a/td/telegram/MessagesManager.h b/td/telegram/MessagesManager.h index 355441dcc..447917b0d 100644 --- a/td/telegram/MessagesManager.h +++ b/td/telegram/MessagesManager.h @@ -663,10 +663,6 @@ class MessagesManager : public Actor { void on_update_scope_notify_settings(NotificationSettingsScope scope, tl_object_ptr &&peer_notify_settings); - bool get_dialog_report_spam_state(DialogId dialog_id, Promise &&promise); - - void change_dialog_report_spam_state(DialogId dialog_id, bool is_spam_dialog, Promise &&promise); - void remove_dialog_action_bar(DialogId dialog_id, Promise &&promise); void report_dialog(DialogId dialog_id, const tl_object_ptr &reason, diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index db99e7e32..16991ffc0 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -2325,25 +2325,6 @@ class GetScopeNotificationSettingsRequest : public RequestActor<> { } }; -class GetChatReportSpamStateRequest : public RequestActor<> { - DialogId dialog_id_; - - bool can_report_spam_ = false; - - void do_run(Promise &&promise) override { - can_report_spam_ = td->messages_manager_->get_dialog_report_spam_state(dialog_id_, std::move(promise)); - } - - void do_send_result() override { - send_result(make_tl_object(can_report_spam_)); - } - - public: - GetChatReportSpamStateRequest(ActorShared td, uint64 request_id, int64 dialog_id) - : RequestActor(std::move(td), request_id), dialog_id_(dialog_id) { - } -}; - class GetStickersRequest : public RequestActor<> { string emoji_; int32 limit_; @@ -6676,18 +6657,6 @@ void Td::on_request(uint64 id, const td_api::getScopeNotificationSettings &reque CREATE_REQUEST(GetScopeNotificationSettingsRequest, get_notification_settings_scope(request.scope_)); } -void Td::on_request(uint64 id, const td_api::getChatReportSpamState &request) { - CHECK_IS_USER(); - CREATE_REQUEST(GetChatReportSpamStateRequest, request.chat_id_); -} - -void Td::on_request(uint64 id, const td_api::changeChatReportSpamState &request) { - CHECK_IS_USER(); - CREATE_OK_REQUEST_PROMISE(); - messages_manager_->change_dialog_report_spam_state(DialogId(request.chat_id_), request.is_spam_chat_, - std::move(promise)); -} - void Td::on_request(uint64 id, const td_api::removeChatActionBar &request) { CHECK_IS_USER(); CREATE_OK_REQUEST_PROMISE(); diff --git a/td/telegram/Td.h b/td/telegram/Td.h index 9b82aeebd..36acc5bf2 100644 --- a/td/telegram/Td.h +++ b/td/telegram/Td.h @@ -844,10 +844,6 @@ class Td final : public NetQueryCallback { void on_request(uint64 id, const td_api::resetAllNotificationSettings &request); - void on_request(uint64 id, const td_api::getChatReportSpamState &request); - - void on_request(uint64 id, const td_api::changeChatReportSpamState &request); - void on_request(uint64 id, const td_api::removeChatActionBar &request); void on_request(uint64 id, td_api::reportChat &request); diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index 3e52b76b8..62af53fb9 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -3618,14 +3618,6 @@ class CliClient final : public Actor { std::tie(group_id, max_notification_id) = split(args); send_request(td_api::make_object(to_integer(group_id), to_integer(max_notification_id))); - } else if (op == "gcrss") { - send_request(td_api::make_object(as_chat_id(args))); - } else if (op == "ccrss") { - string chat_id; - string is_spam_chat; - std::tie(chat_id, is_spam_chat) = split(args); - - send_request(td_api::make_object(as_chat_id(chat_id), as_bool(is_spam_chat))); } else if (op == "rcab") { string chat_id = args; send_request(td_api::make_object(as_chat_id(chat_id)));