diff --git a/apps/meteor/client/components/message/MessageContentBody.tsx b/apps/meteor/client/components/message/MessageContentBody.tsx index d948cd79205b..36a5156f4090 100644 --- a/apps/meteor/client/components/message/MessageContentBody.tsx +++ b/apps/meteor/client/components/message/MessageContentBody.tsx @@ -49,7 +49,10 @@ const MessageContentBody = ({ mentions, channels, md }: MessageContentBodyProps) return undefined; } - return mentions?.find(({ username }) => username === mention); + const filterUser = ({ username, type }: UserMention) => (!type || type === 'user') && username === mention; + const filterTeam = ({ name, type }: UserMention) => type === 'team' && name === mention; + + return mentions?.find((mention) => filterUser(mention) || filterTeam(mention)); }, [mentions], ); diff --git a/packages/gazzodown/src/MarkupInteractionContext.ts b/packages/gazzodown/src/MarkupInteractionContext.ts index 8258e30daba6..c50d58213977 100644 --- a/packages/gazzodown/src/MarkupInteractionContext.ts +++ b/packages/gazzodown/src/MarkupInteractionContext.ts @@ -2,7 +2,7 @@ import type { IRoom, IUser } from '@rocket.chat/core-typings'; import type * as MessageParser from '@rocket.chat/message-parser'; import { createContext, FormEvent, UIEvent } from 'react'; -export type UserMention = Pick; +export type UserMention = Pick; export type ChannelMention = Pick; type MarkupInteractionContextValue = { diff --git a/packages/gazzodown/src/mentions/UserMentionElement.tsx b/packages/gazzodown/src/mentions/UserMentionElement.tsx index 78edbcb41078..17019529f8b9 100644 --- a/packages/gazzodown/src/mentions/UserMentionElement.tsx +++ b/packages/gazzodown/src/mentions/UserMentionElement.tsx @@ -32,7 +32,7 @@ const UserMentionElement = ({ mention }: UserMentionElementProps): ReactElement return (