Replies: Fix "Discussion started" grouping (#6447)

This commit is contained in:
Alexander Zinchuk 2025-11-06 11:37:00 +01:00
parent c2224b6e52
commit bde4688efd

View File

@ -310,7 +310,7 @@ const MessageListContent = ({
const documentGroupId = !isMessageAlbum && message.groupedId ? message.groupedId : undefined; const documentGroupId = !isMessageAlbum && message.groupedId ? message.groupedId : undefined;
const nextDocumentGroupId = nextMessage && !isAlbum(nextMessage) ? nextMessage.groupedId : undefined; const nextDocumentGroupId = nextMessage && !isAlbum(nextMessage) ? nextMessage.groupedId : undefined;
const isTopicTopMessage = message.id === threadId; const isThreadTopMessage = message.id === threadId;
const position = { const position = {
isFirstInGroup: messageIndex === 0, isFirstInGroup: messageIndex === 0,
@ -344,7 +344,7 @@ const MessageListContent = ({
observeIntersectionForPlaying={observeIntersectionForPlaying} observeIntersectionForPlaying={observeIntersectionForPlaying}
album={album} album={album}
noAvatars={noAvatars} noAvatars={noAvatars}
withAvatar={position.isLastInGroup && withUsers && !isOwn && (!isTopicTopMessage || !isComments)} withAvatar={position.isLastInGroup && withUsers && !isOwn && (!isThreadTopMessage || !isComments)}
withSenderName={position.isFirstInGroup && withUsers && !isOwn} withSenderName={position.isFirstInGroup && withUsers && !isOwn}
threadId={threadId} threadId={threadId}
messageListType={type} messageListType={type}
@ -361,15 +361,6 @@ const MessageListContent = ({
onIntersectPinnedMessage={onIntersectPinnedMessage} onIntersectPinnedMessage={onIntersectPinnedMessage}
getIsMessageListReady={getIsReady} getIsMessageListReady={getIsReady}
/>, />,
message.id === threadId && (
// eslint-disable-next-line react-x/no-duplicate-key
<div className="local-action-message" key="discussion-started">
<span>
{oldLang(isEmptyThread
? (isComments ? 'NoComments' : 'NoReplies') : 'DiscussionStarted')}
</span>
</div>
),
]); ]);
}).flat(); }).flat();
@ -380,7 +371,7 @@ const MessageListContent = ({
const lastMessageId = getMessageOriginalId(lastMessage); const lastMessageId = getMessageOriginalId(lastMessage);
const lastAppearanceOrder = messageCountToAnimate - appearanceIndex; const lastAppearanceOrder = messageCountToAnimate - appearanceIndex;
const isTopicTopMessage = lastMessage.id === threadId; const isThreadTopMessage = lastMessage.id === threadId;
const isOwn = isOwnMessage(lastMessage); const isOwn = isOwnMessage(lastMessage);
const firstMessageOrAlbum = senderGroup[0]; const firstMessageOrAlbum = senderGroup[0];
@ -391,8 +382,8 @@ const MessageListContent = ({
const id = (firstMessageId === lastMessageId) ? `message-group-${firstMessageId}` const id = (firstMessageId === lastMessageId) ? `message-group-${firstMessageId}`
: `message-group-${firstMessageId}-${lastMessageId}`; : `message-group-${firstMessageId}-${lastMessageId}`;
const withAvatar = withUsers && !isOwn && (!isTopicTopMessage || !isComments); const withAvatar = withUsers && !isOwn && (!isThreadTopMessage || !isComments);
return ( return compact([
<SenderGroupContainer <SenderGroupContainer
key={key} key={key}
id={id} id={id}
@ -402,9 +393,17 @@ const MessageListContent = ({
canPost={canPost} canPost={canPost}
> >
{senderGroupElements} {senderGroupElements}
</SenderGroupContainer> </SenderGroupContainer>,
); isThreadTopMessage && (
}); <div className="local-action-message" key={`discussion-started-${lastMessageId}`}>
<span>
{oldLang(isEmptyThread
? (isComments ? 'NoComments' : 'NoReplies') : 'DiscussionStarted')}
</span>
</div>
),
]);
}).flat();
} }
const dateGroups = messageGroups.map(( const dateGroups = messageGroups.map((