Topic Author badge only if not admin.

This commit is contained in:
John Preston 2022-11-01 16:54:54 +04:00
parent 7ec1af5e50
commit f13a2517cd

View file

@ -329,10 +329,7 @@ not_null<HistoryMessage*> Message::message() const {
void Message::refreshRightBadge() { void Message::refreshRightBadge() {
const auto text = [&] { const auto text = [&] {
const auto author = delegate()->elementAuthorRank(this); if (data()->isDiscussionPost()) {
if (!author.isEmpty()) {
return author;
} else if (data()->isDiscussionPost()) {
return (delegate()->elementContext() == Context::Replies) return (delegate()->elementContext() == Context::Replies)
? QString() ? QString()
: tr::lng_channel_badge(tr::now); : tr::lng_channel_badge(tr::now);
@ -362,12 +359,13 @@ void Message::refreshRightBadge() {
? tr::lng_admin_badge(tr::now) ? tr::lng_admin_badge(tr::now)
: QString(); : QString();
}(); }();
if (text.isEmpty()) { const auto badge = text.isEmpty()
? delegate()->elementAuthorRank(this)
: TextUtilities::RemoveEmoji(TextUtilities::SingleLine(text));
if (badge.isEmpty()) {
_rightBadge.clear(); _rightBadge.clear();
} else { } else {
_rightBadge.setText( _rightBadge.setText(st::defaultTextStyle, badge);
st::defaultTextStyle,
TextUtilities::RemoveEmoji(TextUtilities::SingleLine(text)));
} }
} }