Message Context Menu: Fix multiple reactions from a single user (#2198)
This commit is contained in:
parent
0782cb1a6b
commit
6ebadcec4d
@ -158,22 +158,26 @@ const ReactorListModal: FC<OwnProps & StateProps> = ({
|
|||||||
items={viewportIds}
|
items={viewportIds}
|
||||||
onLoadMore={getMore}
|
onLoadMore={getMore}
|
||||||
>
|
>
|
||||||
{viewportIds?.map(
|
{viewportIds?.flatMap(
|
||||||
(userId) => {
|
(userId) => {
|
||||||
const user = usersById[userId];
|
const user = usersById[userId];
|
||||||
const reaction = reactors?.reactions.find((l) => l.userId === userId)?.reaction;
|
const userReactions = reactors?.reactions.filter((l) => l.userId === userId);
|
||||||
return (
|
const items: React.ReactNode[] = [];
|
||||||
<ListItem
|
userReactions?.forEach((r) => {
|
||||||
key={userId}
|
items.push(
|
||||||
className="chat-item-clickable reactors-list-item"
|
<ListItem
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
key={`${userId}-${r.reaction}`}
|
||||||
onClick={() => handleClick(userId)}
|
className="chat-item-clickable reactors-list-item"
|
||||||
>
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
<Avatar user={user} size="small" animationLevel={animationLevel} withVideo />
|
onClick={() => handleClick(userId)}
|
||||||
<FullNameTitle peer={user} withEmojiStatus />
|
>
|
||||||
{reaction && <ReactionStaticEmoji className="reactors-list-emoji" reaction={reaction} />}
|
<Avatar user={user} size="small" animationLevel={animationLevel} withVideo />
|
||||||
</ListItem>
|
<FullNameTitle peer={user} withEmojiStatus />
|
||||||
);
|
{r.reaction && <ReactionStaticEmoji className="reactors-list-emoji" reaction={r.reaction} />}
|
||||||
|
</ListItem>,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
return items;
|
||||||
},
|
},
|
||||||
)}
|
)}
|
||||||
</InfiniteScroll>
|
</InfiniteScroll>
|
||||||
|
|||||||
@ -203,7 +203,9 @@ const ContextMenuContainer: FC<OwnProps & StateProps> = ({
|
|||||||
// No need for expensive global updates on users, so we avoid them
|
// No need for expensive global updates on users, so we avoid them
|
||||||
const usersById = getGlobal().users.byId;
|
const usersById = getGlobal().users.byId;
|
||||||
|
|
||||||
return message.reactions?.recentReactions?.slice(0, 3).map(({ userId }) => usersById[userId]).filter(Boolean);
|
const uniqueReactors = new Set(message.reactions?.recentReactions?.map(({ userId }) => usersById[userId]));
|
||||||
|
|
||||||
|
return Array.from(uniqueReactors).filter(Boolean).slice(0, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!message.seenByUserIds) {
|
if (!message.seenByUserIds) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user