Fix couple of comments layout bugs.

This commit is contained in:
John Preston
2025-11-18 20:11:22 +04:00
parent 0babef5a09
commit 04c9d92b4a
5 changed files with 22 additions and 4 deletions

View File

@@ -164,6 +164,7 @@ void Messages::send(TextWithTags text, int stars) {
_sendingIdByRandomId.emplace(randomId, localId);
const auto from = _call->messagesFrom();
const auto creator = _real->creator();
const auto skip = skipMessage(prepared, stars);
if (skip) {
_skippedIds.emplace(localId);
@@ -173,7 +174,7 @@ void Messages::send(TextWithTags text, int stars) {
.peer = from,
.text = std::move(prepared),
.stars = stars,
.admin = (from == _call->peer()),
.admin = (from == _call->peer()) || (creator && from->isSelf()),
.mine = true,
});
}
@@ -233,7 +234,8 @@ void Messages::received(const MTPDupdateGroupCallMessage &data) {
fields.vfrom_id(),
fields.vmessage(),
fields.vdate().v,
fields.vpaid_message_stars().value_or_empty());
fields.vpaid_message_stars().value_or_empty(),
fields.is_from_admin());
}
void Messages::received(const MTPDupdateGroupCallEncryptedMessage &data) {
@@ -268,6 +270,7 @@ void Messages::received(const MTPDupdateGroupCallEncryptedMessage &data) {
deserialized->message,
base::unixtime::now(), // date
0, // stars
false,
true); // checkCustomEmoji
}
@@ -332,6 +335,7 @@ void Messages::received(
const MTPTextWithEntities &message,
TimeId date,
int stars,
bool fromAdmin,
bool checkCustomEmoji) {
const auto peer = _call->peer();
const auto i = ranges::find(_messages, id, &Message::id);
@@ -381,7 +385,7 @@ void Messages::received(
.peer = author,
.text = std::move(text),
.stars = stars,
.admin = (author == _call->peer()),
.admin = fromAdmin,
.mine = mine,
});
ranges::sort(_messages, ranges::less(), &Message::id);

View File

@@ -145,6 +145,7 @@ private:
const MTPTextWithEntities &message,
TimeId date,
int stars,
bool fromAdmin,
bool checkCustomEmoji = false);
void sent(uint64 randomId, const MTP::Response &response);
void sent(uint64 randomId, MsgId realId);

View File

@@ -551,7 +551,14 @@ void MessagesUi::updateMessageSize(MessageView &entry) {
entry.left = _streamMode ? 0 : (_width - entry.width) / 2;
entry.textLeft = leftSkip;
entry.textTop = padding.top() + nameHeight;
entry.nameWidth = std::min(entry.width - widthSkip, nameWidth);
entry.nameWidth = std::min(
nameWidth,
(entry.width
- widthSkip
- space
- _liveBadge.maxWidth()
- space
- _adminBadge.maxWidth()));
updateReactionPosition(entry);
const auto contentHeight = entry.textTop + textHeight + padding.bottom();
@@ -1275,6 +1282,7 @@ void MessagesUi::setupMessagesWidget() {
},
.availableWidth = entry.nameWidth,
.palette = &st::groupCallMessagePalette,
.elisionLines = 1,
});
const auto liveLeft = x + textLeft + entry.nameWidth + space;
_liveBadge.draw(p, {