Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/wet-beers-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': minor
---

Standardizes the display of username with `@` before
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const UserAutoCompleteMultipleOption = ({ label, ...props }: UserAutoCompleteMul

return (
<>
{name} {!_federated && <OptionDescription>({username})</OptionDescription>}
{name} {!_federated && <OptionDescription>@{username}</OptionDescription>}
</>
);
}, [_federated, name, useRealName, username]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { OptionAvatar, OptionColumn, OptionContent, OptionInput } from '@rocket.chat/fuselage';
import { UserAvatar } from '@rocket.chat/ui-avatar';
import { useSetting } from '@rocket.chat/ui-contexts';
import { useTranslation } from 'react-i18next';

import { getUserDisplayNames } from '../../../../lib/getUserDisplayNames';
import ReactiveUserStatus from '../../../components/UserStatus/ReactiveUserStatus';

export type ComposerBoxPopupUserProps = {
Expand All @@ -19,6 +21,9 @@ export type ComposerBoxPopupUserProps = {

function ComposerBoxPopupUser({ _id, system, username, name, nickname, outside, suggestion, variant }: ComposerBoxPopupUserProps) {
const { t } = useTranslation();
const useRealName = useSetting('UI_Use_Real_Name', false);

const [nameOrUsername, displayUsername] = getUserDisplayNames(name, username, useRealName);

return (
<>
Expand All @@ -31,15 +36,15 @@ function ComposerBoxPopupUser({ _id, system, username, name, nickname, outside,
<ReactiveUserStatus uid={_id} />
</OptionColumn>
<OptionContent>
<strong>{name ?? username}</strong> {name && name !== username && username}
{nickname && <span className='popup-user-nickname'>({nickname})</span>}
<strong>{nameOrUsername}</strong> {displayUsername && `@${displayUsername}`}
{nickname && <span className='popup-user-nickname'> ({nickname})</span>}
</OptionContent>
</>
)}

{system && (
<OptionContent>
<strong>{username}</strong> {name}
<strong>@{username}</strong> {name}
</OptionContent>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const RoomMembersItem = ({
</OptionAvatar>
<OptionColumn>{federated ? <Icon name='globe' size='x16' /> : <ReactiveUserStatus uid={_id} />}</OptionColumn>
<OptionContent data-qa={`MemberItem-${username}`}>
{nameOrUsername} {displayUsername && <OptionDescription>({displayUsername})</OptionDescription>}
{nameOrUsername} {displayUsername && <OptionDescription>@{displayUsername}</OptionDescription>}
</OptionContent>
{subscription?.status === 'INVITED' && (
<OptionColumn>
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/tests/e2e/message-mentions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ test.describe.serial('message-mentions', () => {
await poHomeChannel.navbar.openChat('general');
await poHomeChannel.composer.inputMessage.type('@');

await expect(poHomeChannel.content.messagePopupUsers.locator('role=listitem >> text="all"')).toBeVisible();
await expect(poHomeChannel.content.messagePopupUsers.locator('role=listitem >> text="here"')).toBeVisible();
await expect(poHomeChannel.content.messagePopupUsers.locator('role=listitem >> text="@all"')).toBeVisible();
await expect(poHomeChannel.content.messagePopupUsers.locator('role=listitem >> text="@here"')).toBeVisible();
});

test.describe('users not in channel', () => {
Expand Down
Loading