From 1ac48ddfa9a408e141b60899990095b9963e9a7c Mon Sep 17 00:00:00 2001 From: blank X Date: Thu, 20 Jan 2022 18:59:45 +0000 Subject: [PATCH] Reserve space for author icon (#293) --- .../history/view/history_view_message.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index e5d362bf1..dd3214399 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -433,6 +433,25 @@ QSize Message::performCountOptimalSize() { } else if (replyWidth) { namew += st::msgPadding.right() + replyWidth; } + const auto hasChatTypeIcon = [&]() { + if (item->isSponsored()) { + return true; + } else if (!item->isPost() && item->displayFrom()) { + const auto from = item->displayFrom(); + if (from->isChat() || from->isMegagroup() || from->isChannel()) { + return true; + } else if (const auto user = from->asUser()) { + if (user->isInaccessible() + || (user->isBot() && !user->isSupport() && !user->isRepliesChat())) { + return true; + } + } + } + return false; + }(); + if (hasChatTypeIcon) { + namew += st::dialogsChatTypeSkip; + } accumulate_max(maxWidth, namew); } else if (via && !displayForwardedFrom()) { accumulate_max(maxWidth, st::msgPadding.left() + via->maxWidth + st::msgPadding.right());