Always use the first URL as web_page_url in secret chats.

This commit is contained in:
levlam 2023-10-17 00:37:44 +03:00
parent c6a4510779
commit cc08225d30
2 changed files with 5 additions and 4 deletions

View File

@ -57,6 +57,9 @@ Result<InputMessageText> process_input_message_text(const Td *td, DialogId dialo
force_large_media = false;
}
}
if (!disable_web_page_preview && web_page_url.empty() && dialog_id.get_type() == DialogType::SecretChat) {
web_page_url = get_first_url(text);
}
return InputMessageText{std::move(text), std::move(web_page_url), disable_web_page_preview,
force_small_media, force_large_media, input_message_text->clear_draft_};
}

View File

@ -2719,12 +2719,10 @@ SecretInputMedia get_secret_input_media(const MessageContent *content, Td *td,
CHECK(input_file == nullptr);
CHECK(thumbnail.empty());
const auto *m = static_cast<const MessageText *>(content);
auto web_page_url =
!m->web_page_url.empty() ? m->web_page_url : td->web_pages_manager_->get_web_page_url(m->web_page_id);
if (web_page_url.empty()) {
if (m->web_page_url.empty()) {
return SecretInputMedia{};
}
return SecretInputMedia{nullptr, make_tl_object<secret_api::decryptedMessageMediaWebPage>(web_page_url)};
return SecretInputMedia{nullptr, make_tl_object<secret_api::decryptedMessageMediaWebPage>(m->web_page_url)};
}
case MessageContentType::Venue: {
const auto *m = static_cast<const MessageVenue *>(content);