Skip to content
This repository was archived by the owner on Feb 11, 2026. It is now read-only.

Commit 3e9d806

Browse files
committed
fix(user menu): full mxid username cut off
The username displayed in the user menu is a full MXID format. To prevent this issue (in most instances), this removes the matrix.org server name suffix.
1 parent 50a2240 commit 3e9d806

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

src/components/structures/UserMenu.tsx

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,15 @@ export default class UserMenu extends React.Component<IProps, IState> {
370370
? toRightOf(this.state.contextMenuPosition)
371371
: below(this.state.contextMenuPosition);
372372

373+
// elecord, remove matrix.org username suffix
374+
function removeMatrixOrgSuffix(userId: string | null): string | null {
375+
const suffix = ':matrix.org';
376+
if (userId?.endsWith(suffix)) {
377+
return userId.slice(0, -suffix.length);
378+
}
379+
return userId;
380+
}
381+
373382
return (
374383
<IconizedContextMenu {...position} onFinished={this.onCloseMenu} className="mx_UserMenu_contextMenu">
375384
<div className="mx_UserMenu_contextMenu_header">
@@ -378,11 +387,13 @@ export default class UserMenu extends React.Component<IProps, IState> {
378387
{OwnProfileStore.instance.displayName}
379388
</span>
380389
<span className="mx_UserMenu_contextMenu_userId">
381-
{UserIdentifierCustomisations.getDisplayUserIdentifier(
382-
MatrixClientPeg.safeGet().getSafeUserId(),
383-
{
384-
withDisplayName: true,
385-
},
390+
{removeMatrixOrgSuffix(
391+
UserIdentifierCustomisations.getDisplayUserIdentifier(
392+
MatrixClientPeg.safeGet().getSafeUserId(),
393+
{
394+
withDisplayName: true,
395+
},
396+
)
386397
)}
387398
</span>
388399
</div>

0 commit comments

Comments
 (0)