From 0f4e01bde3cf3ec4c367853da4efb442fb0765b8 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 6 Dec 2023 12:28:37 +0300 Subject: [PATCH] Keep reply content if it has link preview options. --- td/telegram/RepliedMessageInfo.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/td/telegram/RepliedMessageInfo.cpp b/td/telegram/RepliedMessageInfo.cpp index 01db210d4..87431a973 100644 --- a/td/telegram/RepliedMessageInfo.cpp +++ b/td/telegram/RepliedMessageInfo.cpp @@ -359,10 +359,20 @@ td_api::object_ptr RepliedMessageInfo::get_messag td_api::object_ptr content; if (content_ != nullptr) { content = get_message_content_object(content_.get(), td, dialog_id, 0, false, true, -1, false, false); - if (content->get_id() == td_api::messageUnsupported::ID || - (content->get_id() == td_api::messageText::ID && - static_cast(content.get())->web_page_ == nullptr)) { - content = nullptr; + switch (content->get_id()) { + case td_api::messageUnsupported::ID: + content = nullptr; + break; + case td_api::messageText::ID: { + const auto *message_text = static_cast(content.get()); + if (message_text->web_page_ == nullptr && message_text->link_preview_options_ == nullptr) { + content = nullptr; + } + break; + } + default: + // nothing to do + break; } }