From 7a535a4554b2d597b8db07dc9638c88e1d7e4801 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sat, 9 Nov 2024 14:56:34 +0300 Subject: [PATCH] Fixed display of sponsored messages with long descriptions and media. --- .../history/view/media/history_view_web_page.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/history/view/media/history_view_web_page.cpp b/Telegram/SourceFiles/history/view/media/history_view_web_page.cpp index 46241702b..432b4bfab 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_web_page.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_web_page.cpp @@ -663,8 +663,8 @@ QSize WebPage::countCurrentSize(int newWidth) { const auto stickerSet = stickerSetData(); const auto factcheck = factcheckData(); const auto sponsored = sponsoredData(); - const auto specialRightPix = ((sponsored && !sponsored->hasMedia) - || stickerSet); + const auto specialRightPix = (stickerSet + || (sponsored && !sponsored->hasMedia && _data->photo)); const auto lineHeight = UnitedLineHeight(); const auto factcheckMetrics = factcheck ? computeFactcheckMetrics(_description.countHeight(innerWidth)) @@ -678,7 +678,7 @@ QSize WebPage::countCurrentSize(int newWidth) { } const auto linesMax = factcheck ? (factcheckMetrics.lines + 1) - : (specialRightPix || isLogEntryOriginal()) + : (sponsored || isLogEntryOriginal()) ? kMaxOriginalEntryLines : 5; const auto siteNameHeight = _siteNameLines ? lineHeight : 0; @@ -711,7 +711,9 @@ QSize WebPage::countCurrentSize(int newWidth) { newHeight += _titleLines * lineHeight; } - const auto descriptionHeight = _description.countHeight(wleft); + const auto descriptionHeight = _description.countHeight(sponsored + ? innerWidth + : wleft); const auto restLines = (linesMax - _siteNameLines - _titleLines); if (descriptionHeight < restLines * descriptionLineHeight) { // We have height for all the lines.