diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index a65917526..d976c7cd2 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -6592,7 +6592,7 @@ sendWebAppData bot_user_id:int53 button_text:string data:string = Ok; //@description Informs TDLib that a Web App is being opened from attachment menu, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an inlineKeyboardButtonTypeWebApp button. //-For each bot, a confirmation alert about data sent to the bot must be shown once -//@chat_id Identifier of the chat in which the Web App is opened +//@chat_id Identifier of the chat in which the Web App is opened. The Web App can't be opened in secret chats //@bot_user_id Identifier of the bot, providing the Web App //@url The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, or an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise //@theme Preferred Web App theme; pass null to use the default theme diff --git a/td/telegram/AttachMenuManager.cpp b/td/telegram/AttachMenuManager.cpp index c8277ff4d..dde4ed5cd 100644 --- a/td/telegram/AttachMenuManager.cpp +++ b/td/telegram/AttachMenuManager.cpp @@ -748,7 +748,8 @@ void AttachMenuManager::request_app_web_view(DialogId dialog_id, UserId bot_user string &&start_parameter, const td_api::object_ptr &theme, string &&platform, bool allow_write_access, Promise &&promise) { - if (!td_->messages_manager_->have_input_peer(dialog_id, AccessRights::Read)) { + if (!td_->messages_manager_->have_input_peer(dialog_id, AccessRights::Read) || + dialog_id.get_type() == DialogType::SecretChat) { dialog_id = DialogId(bot_user_id); } TRY_RESULT_PROMISE(promise, input_user, td_->contacts_manager_->get_input_user(bot_user_id)); diff --git a/td/telegram/CallbackQueriesManager.cpp b/td/telegram/CallbackQueriesManager.cpp index 6be225372..3e6c4cb12 100644 --- a/td/telegram/CallbackQueriesManager.cpp +++ b/td/telegram/CallbackQueriesManager.cpp @@ -253,6 +253,9 @@ void CallbackQueriesManager::send_callback_query(FullMessageId full_message_id, if (!full_message_id.get_message_id().is_server()) { return promise.set_error(Status::Error(400, "Bad message identifier")); } + if (dialog_id.get_type() == DialogType::SecretChat) { + return promise.set_error(Status::Error(400, "Secret chat messages can't have callback buttons")); + } if (payload->get_id() == td_api::callbackQueryPayloadDataWithPassword::ID) { auto password = static_cast(payload.get())->password_; diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 9022f93a3..45d6419c8 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -8187,6 +8187,7 @@ void ContactsManager::report_channel_spam(ChannelId channel_id, const vectormessages_manager_->get_dialog_message_sender({DialogId(channel_id), message_id}); + CHECK(sender_dialog_id.get_type() != DialogType::SecretChat); if (sender_dialog_id.is_valid() && sender_dialog_id != DialogId(get_my_id()) && td_->messages_manager_->have_input_peer(sender_dialog_id, AccessRights::Know)) { server_message_ids[sender_dialog_id].push_back(message_id); diff --git a/td/telegram/GameManager.cpp b/td/telegram/GameManager.cpp index 1ed642ba6..879451d74 100644 --- a/td/telegram/GameManager.cpp +++ b/td/telegram/GameManager.cpp @@ -266,7 +266,7 @@ void GameManager::get_game_high_scores(FullMessageId full_message_id, UserId use return promise.set_error(Status::Error(400, "Can't access the chat")); } auto message_id = full_message_id.get_message_id(); - if (message_id.is_scheduled() || !message_id.is_server()) { + if (message_id.is_scheduled() || !message_id.is_server() || dialog_id.get_type() == DialogType::SecretChat) { return promise.set_error(Status::Error(400, "Wrong message identifier specified")); }