diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index 4bba62d73..b17f1ba4f 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -534,6 +534,13 @@ void Message::refreshRightBadge() { ).append(many ? QString::number(boosts) : QString()); badge.append(' ').append(Ui::Text::Colorized(added, 1)); } + _rightBadgeIsChannel = 0; + if ( + item->isDiscussionPost() && delegate()->elementContext() != Context::Replies || + data()->history()->peer->isMegagroup() && data()->author()->isChannel() && !data()->out() + ) { + _rightBadgeIsChannel = 1; + } if (badge.empty()) { _rightBadge.clear(); } else { @@ -825,7 +832,7 @@ QSize Message::performCountOptimalSize() { : 0; if (!_rightBadge.isEmpty()) { const auto badgeWidth = - _rightBadge.toString() == tr::lng_channel_badge(tr::now) ? st::inChannelBadgeIcon.width() : _rightBadge.maxWidth(); + _rightBadgeIsChannel ? st::inChannelBadgeIcon.width() : _rightBadge.maxWidth(); namew += st::msgPadding.right() + std::max(badgeWidth, replyWidth); } else if (replyWidth) { @@ -1456,7 +1463,7 @@ void Message::paintFromName( return; } const auto badgeWidth = _rightBadge.isEmpty() ? 0 : - _rightBadge.toString() == tr::lng_channel_badge(tr::now) ? context.messageStyle()->channelBadgeIcon.width() : _rightBadge.maxWidth(); + _rightBadgeIsChannel ? context.messageStyle()->channelBadgeIcon.width() : _rightBadge.maxWidth(); const auto replyWidth = [&] { if (isUnderCursor() && displayFastReply()) { return st::msgFont->width(FastReplyText()); @@ -1556,7 +1563,7 @@ void Message::paintFromName( trect.top() + st::msgFont->ascent, FastReplyText()); } else { - if (_rightBadge.toString() == tr::lng_channel_badge(tr::now)) { + if (_rightBadgeIsChannel) { stm->channelBadgeIcon.paint( p, trect.left() + trect.width() - rightWidth, diff --git a/Telegram/SourceFiles/history/view/history_view_message.h b/Telegram/SourceFiles/history/view/history_view_message.h index 62ab6c02b..a84866e54 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.h +++ b/Telegram/SourceFiles/history/view/history_view_message.h @@ -309,6 +309,7 @@ private: uint32 _invertMedia : 1 = 0; uint32 _hideReply : 1 = 0; uint32 _rightBadgeHasBoosts : 1 = 0; + uint32 _rightBadgeIsChannel : 1 = 0; BottomInfo _bottomInfo;