From a56d0279fcbaa3bbe8da3a9f5b91c4534b74f901 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Tue, 3 Sep 2024 13:41:32 +1000 Subject: [PATCH] fix: reactor count was at most 4 even if hundrers reacted --- .../message/reactions/ReactionPopup.tsx | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/ts/components/conversation/message/reactions/ReactionPopup.tsx b/ts/components/conversation/message/reactions/ReactionPopup.tsx index a33d73efb..55a034098 100644 --- a/ts/components/conversation/message/reactions/ReactionPopup.tsx +++ b/ts/components/conversation/message/reactions/ReactionPopup.tsx @@ -62,22 +62,19 @@ const StyledEmoji = styled.span` const generateContactsString = ( senders: Array -): { contacts: Array; numberOfReactors: number; hasMe: boolean } => { +): { contacts: Array; hasMe: boolean } => { const contacts: Array = []; let hasMe = false; - let numberOfReactors = 0; senders.forEach(sender => { // TODO truncate with ellipsis if too long? const contact = findAndFormatContact(sender); if (contact.isMe) { hasMe = true; - numberOfReactors++; } else { contacts.push(contact?.profileName ?? contact?.name ?? PubKey.shorten(sender)); - numberOfReactors++; } }); - return { contacts, hasMe, numberOfReactors }; + return { contacts, hasMe }; }; const getI18nComponentProps = ( @@ -118,7 +115,7 @@ type Props = { }; export const ReactionPopup = (props: Props) => { - const { emoji, senders, tooltipPosition = 'center', onClick } = props; + const { emoji, senders, tooltipPosition = 'center', count, onClick } = props; const { emojiName, emojiAriaLabel } = useMemo( () => ({ @@ -128,14 +125,11 @@ export const ReactionPopup = (props: Props) => { [emoji] ); - const { contacts, hasMe, numberOfReactors } = useMemo( - () => generateContactsString(senders), - [senders] - ); + const { contacts, hasMe } = useMemo(() => generateContactsString(senders), [senders]); const i18nProps = useMemo( - () => getI18nComponentProps(hasMe, contacts, numberOfReactors, emoji, emojiName), - [hasMe, contacts, numberOfReactors, emoji, emojiName] + () => getI18nComponentProps(hasMe, contacts, count, emoji, emojiName), + [hasMe, contacts, count, emoji, emojiName] ); return (