Use AccessRights::Know to get business input peer.

This commit is contained in:
levlam 2024-03-12 14:16:47 +03:00
parent d3de4a16e4
commit 2ec98338f4
2 changed files with 4 additions and 3 deletions

View File

@ -6,6 +6,7 @@
//
#include "td/telegram/BusinessConnectionManager.h"
#include "td/telegram/AccessRights.h"
#include "td/telegram/AuthManager.h"
#include "td/telegram/ContactsManager.h"
#include "td/telegram/DialogManager.h"
@ -133,7 +134,7 @@ class BusinessConnectionManager::SendBusinessMessageQuery final : public Td::Res
flags |= telegram_api::messages_sendMessage::INVERT_MEDIA_MASK;
}
auto input_peer = td_->dialog_manager_->get_input_peer_force(message_->dialog_id_);
auto input_peer = td_->dialog_manager_->get_input_peer(message_->dialog_id_, AccessRights::Know);
CHECK(input_peer != nullptr);
auto reply_to = message_->input_reply_to_.get_input_reply_to(td_, MessageId());
@ -204,7 +205,7 @@ class BusinessConnectionManager::SendBusinessMediaQuery final : public Td::Resul
flags |= telegram_api::messages_sendMedia::INVERT_MEDIA_MASK;
}
auto input_peer = td_->dialog_manager_->get_input_peer_force(message_->dialog_id_);
auto input_peer = td_->dialog_manager_->get_input_peer(message_->dialog_id_, AccessRights::Know);
CHECK(input_peer != nullptr);
auto reply_to = message_->input_reply_to_.get_input_reply_to(td_, MessageId());

View File

@ -322,7 +322,7 @@ void DialogActionManager::send_dialog_action(DialogId dialog_id, MessageId top_t
return promise.set_error(Status::Error(400, "Have no access to the chat"));
}
} else if (as_business) {
input_peer = td_->dialog_manager_->get_input_peer_force(dialog_id);
input_peer = td_->dialog_manager_->get_input_peer(dialog_id, AccessRights::Know);
} else {
if (!td_->dialog_manager_->have_input_peer(dialog_id, AccessRights::Write)) {
if (td_->auth_manager_->is_bot()) {