Allow to send invoice messages in all chat types.

This commit is contained in:
levlam 2021-03-31 02:45:10 +03:00
parent 32a5fc6855
commit aa65e2b586
2 changed files with 7 additions and 14 deletions

View File

@ -1754,6 +1754,7 @@ bool InlineQueriesManager::load_recently_used_bots(Promise<Unit> &promise) {
tl_object_ptr<td_api::inlineQueryResults> InlineQueriesManager::get_inline_query_results_object(uint64 query_hash) { tl_object_ptr<td_api::inlineQueryResults> InlineQueriesManager::get_inline_query_results_object(uint64 query_hash) {
// TODO filter out games if request is sent in a broadcast channel or in a secret chat // TODO filter out games if request is sent in a broadcast channel or in a secret chat
// TODO filter out invoice messages if request is sent in a secret chat
return decrease_pending_request_count(query_hash); return decrease_pending_request_count(query_hash);
} }

View File

@ -23134,7 +23134,7 @@ Status MessagesManager::can_send_message_content(DialogId dialog_id, const Messa
break; break;
case MessageContentType::Audio: case MessageContentType::Audio:
if (!permissions.can_send_media()) { if (!permissions.can_send_media()) {
return Status::Error(400, "Not enough rights to send audios to the chat"); return Status::Error(400, "Not enough rights to send music to the chat");
} }
break; break;
case MessageContentType::Contact: case MessageContentType::Contact:
@ -23167,19 +23167,11 @@ Status MessagesManager::can_send_message_content(DialogId dialog_id, const Messa
} }
break; break;
case MessageContentType::Invoice: case MessageContentType::Invoice:
if (!is_forward) { if (!permissions.can_send_messages()) {
switch (dialog_type) { return Status::Error(400, "Not enough rights to send invoice messages to the chat");
case DialogType::User:
// ok
break;
case DialogType::Chat:
case DialogType::Channel:
case DialogType::SecretChat:
return Status::Error(400, "Invoices can be sent only to private chats");
case DialogType::None:
default:
UNREACHABLE();
} }
if (dialog_type == DialogType::SecretChat) {
return Status::Error(400, "Invoice messages can't be sent to secret chats");
} }
break; break;
case MessageContentType::LiveLocation: case MessageContentType::LiveLocation: