Expect valid business_connection_id in check_business_connection.

This commit is contained in:
levlam 2024-03-11 18:38:03 +03:00
parent 985cbf1a31
commit e717e25a1d
2 changed files with 4 additions and 6 deletions

View File

@ -95,9 +95,6 @@ void BusinessConnectionManager::tear_down() {
Status BusinessConnectionManager::check_business_connection(const BusinessConnectionId &connection_id,
DialogId dialog_id) const {
if (connection_id.is_empty()) {
return Status::OK();
}
auto connection = business_connections_.get_pointer(connection_id);
if (connection == nullptr) {
return Status::Error(400, "Business connection not found");

View File

@ -296,10 +296,11 @@ void DialogActionManager::send_update_chat_action(DialogId dialog_id, MessageId
void DialogActionManager::send_dialog_action(DialogId dialog_id, MessageId top_thread_message_id,
BusinessConnectionId business_connection_id, DialogAction action,
Promise<Unit> &&promise) {
bool as_business = business_connection_id.is_valid();
if (as_business) {
TRY_STATUS_PROMISE(promise,
td_->business_connection_manager_->check_business_connection(business_connection_id, dialog_id));
bool as_business = business_connection_id.is_valid();
if (!as_business && !td_->dialog_manager_->have_dialog_force(dialog_id, "send_dialog_action")) {
} else if (!td_->dialog_manager_->have_dialog_force(dialog_id, "send_dialog_action")) {
return promise.set_error(Status::Error(400, "Chat not found"));
}
if (top_thread_message_id != MessageId() &&