Fix get_replied_message.

GitOrigin-RevId: de539d5bf3f676ad67805524b7b61d60cb4f5cc3
This commit is contained in:
levlam 2018-02-14 08:51:35 +03:00
parent 841d5a1d20
commit b72fd09756

View File

@ -11049,6 +11049,7 @@ void MessagesManager::get_message(FullMessageId full_message_id, Promise<Unit> &
MessageId MessagesManager::get_replied_message(DialogId dialog_id, MessageId message_id, bool force, MessageId MessagesManager::get_replied_message(DialogId dialog_id, MessageId message_id, bool force,
Promise<Unit> &&promise) { Promise<Unit> &&promise) {
LOG(INFO) << "Get replied message to " << message_id << " in " << dialog_id;
Dialog *d = get_dialog_force(dialog_id); Dialog *d = get_dialog_force(dialog_id);
if (d == nullptr) { if (d == nullptr) {
promise.set_error(Status::Error(6, "Chat not found")); promise.set_error(Status::Error(6, "Chat not found"));
@ -11065,14 +11066,13 @@ MessageId MessagesManager::get_replied_message(DialogId dialog_id, MessageId mes
return MessageId(); return MessageId();
} }
auto replied_message_id = get_replied_message_id(m); tl_object_ptr<telegram_api::InputMessage> input_message;
if (!replied_message_id.is_valid()) { if (message_id.is_server()) {
promise.set_value(Unit()); input_message = make_tl_object<telegram_api::inputMessageReplyTo>(message_id.get_server_message_id().get());
return MessageId();
} }
get_message_force_from_server( auto replied_message_id = get_replied_message_id(m);
d, replied_message_id, std::move(promise), get_message_force_from_server(d, replied_message_id, std::move(promise), std::move(input_message));
make_tl_object<telegram_api::inputMessageReplyTo>(message_id.get_server_message_id().get()));
return replied_message_id; return replied_message_id;
} }