diff --git a/apps/meteor/client/views/room/MessageList/components/MessageReaction.tsx b/apps/meteor/client/views/room/MessageList/components/MessageReaction.tsx index d4c0bf14894..9bf79dfd973 100644 --- a/apps/meteor/client/views/room/MessageList/components/MessageReaction.tsx +++ b/apps/meteor/client/views/room/MessageList/components/MessageReaction.tsx @@ -4,21 +4,7 @@ import React, { FC, useRef } from 'react'; import { getEmojiClassNameAndDataTitle } from '../../../../lib/utils/renderEmoji'; -type TranslationRepliesKey = - | 'You_have_reacted' - | 'Users_and_more_reacted_with' - | 'You_and_more_Reacted_with' - | 'You_users_and_more_Reacted_with' - | 'Users_reacted_with' - | 'You_and_users_Reacted_with'; - -// "You": "You", -// "You_user_have_reacted": "You have reacted", -// "Users_and_more_reacted_with": "__users__ and __count__ more have reacted with __emoji__", -// "You_and_more_Reacted_with": "You, __users__ and __count__ more have reacted with __emoji__", -// "You_and_Reacted_with": "You and __count__ more have reacted with __emoji__", - -const getTranslationKey = (users: string[], mine: boolean): TranslationRepliesKey => { +const getTranslationKey = (users: string[], mine: boolean): TranslationKey => { if (users.length === 0) { if (mine) { return 'You_have_reacted'; @@ -27,7 +13,7 @@ const getTranslationKey = (users: string[], mine: boolean): TranslationRepliesKe if (users.length > 15) { if (mine) { - return 'You_and_more_Reacted_with'; + return 'You_users_and_more_Reacted_with'; } return 'Users_and_more_reacted_with'; } @@ -68,7 +54,7 @@ export const MessageReaction: FC<{ ref.current && openTooltip( <> - {t(key as TranslationKey, { + {t(key, { counter: names.length, users: names.join(', '), emoji: name, diff --git a/apps/meteor/client/views/room/MessageList/providers/MessageListProvider.tsx b/apps/meteor/client/views/room/MessageList/providers/MessageListProvider.tsx index 999e295ab1c..88d55ccebb2 100644 --- a/apps/meteor/client/views/room/MessageList/providers/MessageListProvider.tsx +++ b/apps/meteor/client/views/room/MessageList/providers/MessageListProvider.tsx @@ -48,7 +48,7 @@ export const MessageListProvider: FC<{ return []; } if (!isMessageReactionsNormalized(message)) { - return (message.reactions && message.reactions[reaction]?.usernames.map((username) => `@${username}`)) || []; + return message.reactions?.[reaction]?.usernames.filter((user) => user !== username).map((username) => `@${username}`) || []; } if (!username) { return message.reactions[reaction].names; @@ -64,7 +64,7 @@ export const MessageListProvider: FC<{ useUserHasReacted: username ? (message) => (reaction): boolean => - Boolean(message.reactions && message.reactions[reaction].usernames.includes(username)) + Boolean(message.reactions?.[reaction].usernames.includes(username)) : () => (): boolean => false, useShowFollowing: uid ? ({ message }): boolean => Boolean(message.replies && message.replies.indexOf(uid) > -1)