Fix userpic painting for guest chat bot messages.

This commit is contained in:
John Preston
2026-04-12 11:44:50 +07:00
parent ffe5f1ac00
commit a65593cadd
5 changed files with 20 additions and 1 deletions
+8
View File
@@ -2761,6 +2761,14 @@ bool History::loadedAtTop() const {
return _loadedAtTop;
}
bool History::hasGuestChatBotMessages() const {
return _flags & Flag::HasGuestChatBotMessages;
}
void History::setHasGuestChatBotMessages() {
_flags |= Flag::HasGuestChatBotMessages;
}
bool History::isReadyFor(MsgId msgId) {
if (msgId < 0 && -msgId < ServerMaxMsgId && peer->migrateFrom()) {
// Old group history.
+3
View File
@@ -242,6 +242,8 @@ public:
[[nodiscard]] bool loadedAtBottom() const; // last message is in the list
void setNotLoadedAtBottom();
[[nodiscard]] bool loadedAtTop() const; // nothing was added after loading history back
[[nodiscard]] bool hasGuestChatBotMessages() const;
void setHasGuestChatBotMessages();
[[nodiscard]] bool isReadyFor(MsgId msgId); // has messages for showing history at msgId
void getReadyFor(MsgId msgId);
@@ -499,6 +501,7 @@ private:
HasPinnedMessages = (1 << 6),
ResolveChatListMessage = (1 << 7),
MonoAndForumUnreadInvalidatePending = (1 << 8),
HasGuestChatBotMessages = (1 << 9),
};
using Flags = base::flags<Flag>;
friend inline constexpr auto is_flag_type(Flag) {
@@ -912,7 +912,8 @@ bool HistoryInner::canHaveFromUserpics() const {
&& !_peer->isSelf()
&& !_peer->isRepliesChat()
&& !_peer->isVerifyCodes()
&& !_isChatWide) {
&& !_isChatWide
&& !_history->hasGuestChatBotMessages()) {
return false;
} else if (const auto channel = _peer->asBroadcast()) {
return channel->signatureProfiles();
@@ -813,6 +813,9 @@ HistoryItem::HistoryItem(
if (_effectId) {
_history->owner().reactions().preloadEffectImageFor(_effectId);
}
if (isGuestChatBotMessage()) {
_history->setHasGuestChatBotMessages();
}
}
HistoryItem::HistoryItem(
@@ -2538,6 +2538,10 @@ void Message::clickHandlerPressedChanged(
&& (handler == via->link)
&& !displayForwardedFrom()) {
startLinkRipple();
} else if (const auto guestChat = data()->Get<HistoryMessageGuestChat>()
; guestChat
&& (handler == guestChat->link)) {
startLinkRipple();
} else if (const auto forwarded = data()->Get<HistoryMessageForwarded>()
; forwarded
&& displayForwardedFrom()