From c2f337664edf20fa0e0dbec71290c0575ee41902 Mon Sep 17 00:00:00 2001 From: gabriellsh <40830821+gabriellsh@users.noreply.github.com> Date: Fri, 27 Oct 2023 12:28:57 -0300 Subject: [PATCH] fix: Mentions showing usernames instead of names on smaller screens (#30705) --- .changeset/fuzzy-plums-travel.md | 5 +++++ packages/gazzodown/src/mentions/UserMentionElement.tsx | 7 ++----- 2 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 .changeset/fuzzy-plums-travel.md diff --git a/.changeset/fuzzy-plums-travel.md b/.changeset/fuzzy-plums-travel.md new file mode 100644 index 000000000000..fec86862a711 --- /dev/null +++ b/.changeset/fuzzy-plums-travel.md @@ -0,0 +1,5 @@ +--- +"@rocket.chat/gazzodown": patch +--- + +fixed an issue with mentions showing usernames instead of names on smaller screens diff --git a/packages/gazzodown/src/mentions/UserMentionElement.tsx b/packages/gazzodown/src/mentions/UserMentionElement.tsx index 308363309aa2..a25106918af8 100644 --- a/packages/gazzodown/src/mentions/UserMentionElement.tsx +++ b/packages/gazzodown/src/mentions/UserMentionElement.tsx @@ -13,14 +13,11 @@ const handleUserMention = (mention: string | undefined, withSymbol: boolean | un const UserMentionElement = ({ mention }: UserMentionElementProps): ReactElement => { const t = useTranslation(); - const { resolveUserMention, onUserMentionClick, isMobile, ownUserId, useRealName, showMentionSymbol } = - useContext(MarkupInteractionContext); + const { resolveUserMention, onUserMentionClick, ownUserId, useRealName, showMentionSymbol } = useContext(MarkupInteractionContext); const resolved = useMemo(() => resolveUserMention?.(mention), [mention, resolveUserMention]); const handleClick = useMemo(() => (resolved ? onUserMentionClick?.(resolved) : undefined), [resolved, onUserMentionClick]); - const showRealName = useRealName && !isMobile; - if (mention === 'all') { return ( @@ -49,7 +46,7 @@ const UserMentionElement = ({ mention }: UserMentionElementProps): ReactElement onClick={handleClick} data-uid={resolved._id} > - {handleUserMention((showRealName ? resolved.name : resolved.username) ?? mention, showMentionSymbol)} + {handleUserMention((useRealName ? resolved.name : resolved.username) ?? mention, showMentionSymbol)} ); };