2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 06:07:45 +00:00

Reserve space for author icon (#293)

This commit is contained in:
blank X 2022-01-20 18:59:45 +00:00 committed by GitHub
parent a9919db7fa
commit 1ac48ddfa9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -433,6 +433,25 @@ QSize Message::performCountOptimalSize() {
} else if (replyWidth) { } else if (replyWidth) {
namew += st::msgPadding.right() + 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); accumulate_max(maxWidth, namew);
} else if (via && !displayForwardedFrom()) { } else if (via && !displayForwardedFrom()) {
accumulate_max(maxWidth, st::msgPadding.left() + via->maxWidth + st::msgPadding.right()); accumulate_max(maxWidth, st::msgPadding.left() + via->maxWidth + st::msgPadding.right());