Open type="document" with photo as a photo.

Fixes #25600.
This commit is contained in:
John Preston 2023-01-02 15:08:36 +04:00
parent 741b524d71
commit 19350e3846
4 changed files with 8 additions and 1 deletions

View file

@ -144,6 +144,8 @@ WebPageType ParseWebPageType(
return WebPageType::Video; return WebPageType::Video;
} else if (type == u"photo"_q) { } else if (type == u"photo"_q) {
return WebPageType::Photo; return WebPageType::Photo;
} else if (type == u"document"_q) {
return WebPageType::Document;
} else if (type == u"profile"_q) { } else if (type == u"profile"_q) {
return WebPageType::Profile; return WebPageType::Profile;
} else if (type == u"telegram_background"_q) { } else if (type == u"telegram_background"_q) {

View file

@ -26,6 +26,7 @@ enum class WebPageType {
Photo, Photo,
Video, Video,
Document,
User, User,
Bot, Bot,

View file

@ -166,6 +166,7 @@ QSize WebPage::countOptimalSize() {
} else if (!_data->document } else if (!_data->document
&& _data->photo && _data->photo
&& _data->type != WebPageType::Photo && _data->type != WebPageType::Photo
&& _data->type != WebPageType::Document
&& _data->type != WebPageType::Video) { && _data->type != WebPageType::Video) {
if (_data->type == WebPageType::Profile) { if (_data->type == WebPageType::Profile) {
_asArticle = true; _asArticle = true;
@ -755,6 +756,7 @@ ClickHandlerPtr WebPage::replaceAttachLink(
|| _data->type == WebPageType::Video) { || _data->type == WebPageType::Video) {
return _openl; return _openl;
} else if (_data->type == WebPageType::Photo } else if (_data->type == WebPageType::Photo
|| _data->type == WebPageType::Document
|| _data->siteName == u"Twitter"_q || _data->siteName == u"Twitter"_q
|| _data->siteName == u"Facebook"_q) { || _data->siteName == u"Facebook"_q) {
// leave photo link // leave photo link

View file

@ -1610,9 +1610,11 @@ Link::Link(
}), }),
parent->fullId()); parent->fullId());
} else if (_page->photo) { } else if (_page->photo) {
if (_page->type == WebPageType::Profile || _page->type == WebPageType::Video) { if (_page->type == WebPageType::Profile
|| _page->type == WebPageType::Video) {
_photol = createHandler(_page->url); _photol = createHandler(_page->url);
} else if (_page->type == WebPageType::Photo } else if (_page->type == WebPageType::Photo
|| _page->type == WebPageType::Document
|| _page->siteName == u"Twitter"_q || _page->siteName == u"Twitter"_q
|| _page->siteName == u"Facebook"_q) { || _page->siteName == u"Facebook"_q) {
_photol = std::make_shared<PhotoOpenClickHandler>( _photol = std::make_shared<PhotoOpenClickHandler>(