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) {
// 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);
}

View File

@ -23134,7 +23134,7 @@ Status MessagesManager::can_send_message_content(DialogId dialog_id, const Messa
break;
case MessageContentType::Audio:
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;
case MessageContentType::Contact:
@ -23167,19 +23167,11 @@ Status MessagesManager::can_send_message_content(DialogId dialog_id, const Messa
}
break;
case MessageContentType::Invoice:
if (!is_forward) {
switch (dialog_type) {
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 (!permissions.can_send_messages()) {
return Status::Error(400, "Not enough rights to send invoice messages to the chat");
}
if (dialog_type == DialogType::SecretChat) {
return Status::Error(400, "Invoice messages can't be sent to secret chats");
}
break;
case MessageContentType::LiveLocation: