Message List: Fix for paid messages banner (#5799)

This commit is contained in:
Alexander Zinchuk 2025-04-23 18:59:00 +02:00
parent 9636876aad
commit 79949b71c5

View File

@ -133,6 +133,7 @@ type StateProps = {
areAdsEnabled?: boolean; areAdsEnabled?: boolean;
channelJoinInfo?: ApiChatFullInfo['joinInfo']; channelJoinInfo?: ApiChatFullInfo['joinInfo'];
isChatProtected?: boolean; isChatProtected?: boolean;
hasCustomGreeting?: boolean;
}; };
const MESSAGE_REACTIONS_POLLING_INTERVAL = 20 * 1000; const MESSAGE_REACTIONS_POLLING_INTERVAL = 20 * 1000;
@ -195,6 +196,7 @@ const MessageList: FC<OwnProps & StateProps> = ({
onIntersectPinnedMessage, onIntersectPinnedMessage,
onScrollDownToggle, onScrollDownToggle,
onNotchToggle, onNotchToggle,
hasCustomGreeting,
}) => { }) => {
const { const {
loadViewportMessages, setScrollOffset, loadSponsoredMessages, loadMessageReactions, copyMessagesByIds, loadViewportMessages, setScrollOffset, loadSponsoredMessages, loadMessageReactions, copyMessagesByIds,
@ -696,7 +698,7 @@ const MessageList: FC<OwnProps & StateProps> = ({
{restrictionReason ? restrictionReason.text : `This is a private ${isChannelChat ? 'channel' : 'chat'}`} {restrictionReason ? restrictionReason.text : `This is a private ${isChannelChat ? 'channel' : 'chat'}`}
</span> </span>
</div> </div>
) : paidMessagesStars && isPrivate && !hasMessages ? ( ) : paidMessagesStars && isPrivate && !hasMessages && !hasCustomGreeting ? (
<RequirementToContactMessage paidMessagesStars={paidMessagesStars} userId={chatId} /> <RequirementToContactMessage paidMessagesStars={paidMessagesStars} userId={chatId} />
) : isContactRequirePremium && !hasMessages ? ( ) : isContactRequirePremium && !hasMessages ? (
<RequirementToContactMessage userId={chatId} /> <RequirementToContactMessage userId={chatId} />
@ -795,6 +797,8 @@ export default memo(withGlobal<OwnProps>(
const isCurrentUserPremium = selectIsCurrentUserPremium(global); const isCurrentUserPremium = selectIsCurrentUserPremium(global);
const areAdsEnabled = !isCurrentUserPremium || selectUserFullInfo(global, currentUserId)?.areAdsEnabled; const areAdsEnabled = !isCurrentUserPremium || selectUserFullInfo(global, currentUserId)?.areAdsEnabled;
const hasCustomGreeting = Boolean(userFullInfo?.businessIntro);
return { return {
areAdsEnabled, areAdsEnabled,
isChatLoaded: true, isChatLoaded: true,
@ -828,6 +832,7 @@ export default memo(withGlobal<OwnProps>(
currentUserId, currentUserId,
isChatProtected: selectIsChatProtected(global, chatId), isChatProtected: selectIsChatProtected(global, chatId),
...(withLastMessageWhenPreloading && { lastMessage }), ...(withLastMessageWhenPreloading && { lastMessage }),
hasCustomGreeting,
}; };
}, },
)(MessageList)); )(MessageList));