Forcely load chosen chat from database.

This commit is contained in:
levlam 2023-01-13 17:47:08 +03:00
parent 97cc57a25c
commit 14fbdf5928

View File

@ -29749,7 +29749,7 @@ void MessagesManager::do_send_screenshot_taken_notification_message(DialogId dia
void MessagesManager::send_chosen_dialog(FullMessageId full_message_id, int32 button_id, DialogId chosen_dialog_id, void MessagesManager::send_chosen_dialog(FullMessageId full_message_id, int32 button_id, DialogId chosen_dialog_id,
Promise<Unit> &&promise) { Promise<Unit> &&promise) {
const Message *m = get_message_force(full_message_id, "send_chosen_user"); const Message *m = get_message_force(full_message_id, "send_chosen_dialog");
if (m == nullptr) { if (m == nullptr) {
return promise.set_error(Status::Error(400, "Message not found")); return promise.set_error(Status::Error(400, "Message not found"));
} }
@ -29757,6 +29757,9 @@ void MessagesManager::send_chosen_dialog(FullMessageId full_message_id, int32 bu
return promise.set_error(Status::Error(400, "Message has no buttons")); return promise.set_error(Status::Error(400, "Message has no buttons"));
} }
CHECK(m->message_id.is_valid() && m->message_id.is_server()); CHECK(m->message_id.is_valid() && m->message_id.is_server());
if (chosen_dialog_id.get_type() != DialogType::User) {
get_dialog_force(chosen_dialog_id, "send_chosen_dialog");
}
TRY_STATUS_PROMISE(promise, m->reply_markup->check_chosen_dialog(td_, button_id, chosen_dialog_id)); TRY_STATUS_PROMISE(promise, m->reply_markup->check_chosen_dialog(td_, button_id, chosen_dialog_id));
td_->create_handler<SendBotRequestedPeer>(std::move(promise))->send(full_message_id, button_id, chosen_dialog_id); td_->create_handler<SendBotRequestedPeer>(std::move(promise))->send(full_message_id, button_id, chosen_dialog_id);