From 6917503e5e6bcac3faa56ca5b37beaa216093e23 Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 16 Oct 2023 23:18:43 +0300 Subject: [PATCH] Remove WebPagesManager::get_secret_input_media. --- td/telegram/MessageContent.cpp | 7 ++++++- td/telegram/WebPagesManager.cpp | 12 ------------ td/telegram/WebPagesManager.h | 2 -- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp index 071f9c11b..3873d604c 100644 --- a/td/telegram/MessageContent.cpp +++ b/td/telegram/MessageContent.cpp @@ -2715,7 +2715,12 @@ SecretInputMedia get_secret_input_media(const MessageContent *content, Td *td, CHECK(input_file == nullptr); CHECK(thumbnail.empty()); const auto *m = static_cast(content); - return td->web_pages_manager_->get_secret_input_media(m->web_page_id); + 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()) { + return SecretInputMedia{}; + } + return SecretInputMedia{nullptr, make_tl_object(web_page_url)}; } case MessageContentType::Venue: { const auto *m = static_cast(content); diff --git a/td/telegram/WebPagesManager.cpp b/td/telegram/WebPagesManager.cpp index 1ad4bea92..0b511f1e3 100644 --- a/td/telegram/WebPagesManager.cpp +++ b/td/telegram/WebPagesManager.cpp @@ -1223,18 +1223,6 @@ void WebPagesManager::reload_web_page_by_url(const string &url, Promisecreate_handler(std::move(promise))->send(WebPageId(), url, 0); } -SecretInputMedia WebPagesManager::get_secret_input_media(WebPageId web_page_id) const { - if (!web_page_id.is_valid()) { - return SecretInputMedia{}; - } - - const WebPage *web_page = get_web_page(web_page_id); - if (web_page == nullptr) { - return SecretInputMedia{}; - } - return SecretInputMedia{nullptr, make_tl_object(web_page->url_)}; -} - bool WebPagesManager::have_web_page(WebPageId web_page_id) const { if (!web_page_id.is_valid()) { return false; diff --git a/td/telegram/WebPagesManager.h b/td/telegram/WebPagesManager.h index 487bf4c16..4c6af2306 100644 --- a/td/telegram/WebPagesManager.h +++ b/td/telegram/WebPagesManager.h @@ -83,8 +83,6 @@ class WebPagesManager final : public Actor { void on_get_web_page_preview(const string &first_url, tl_object_ptr &&message_media_ptr, Promise> &&promise); - SecretInputMedia get_secret_input_media(WebPageId web_page_id) const; - void on_binlog_web_page_event(BinlogEvent &&event); FileSourceId get_url_file_source_id(const string &url);