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

Commit

Permalink
Fix ts-strict issues
Browse files Browse the repository at this point in the history
  • Loading branch information
justjanne committed Jan 18, 2023
1 parent fd1118c commit c46b10b
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions src/components/views/messages/DisambiguatedProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,34 +38,32 @@ export default class DisambiguatedProfile extends React.Component<IProps> {
const rawDisplayName = member?.rawDisplayName || fallbackName;
const mxid = member?.userId;

let colorClass;
let colorClass: string | undefined;
if (colored) {
colorClass = getUserNameColorClass(fallbackName);
}

let mxidElement;
if (member?.disambiguate && mxid) {
mxidElement = (
<span className="mx_DisambiguatedProfile_mxid">
{UserIdentifier.getDisplayUserIdentifier(mxid, { withDisplayName: true, roomId: member.roomId })}
</span>
);
}
let title: string | undefined;

let title: string;
if (mxid) {
const identifier = UserIdentifier.getDisplayUserIdentifier?.(mxid, {
withDisplayName: true,
roomId: member.roomId
}) ?? mxid;
if (member?.disambiguate) {
mxidElement = (
<span className="mx_DisambiguatedProfile_mxid">{ identifier }</span>
);
}
title = _t('%(displayName)s (%(matrixId)s)', {
displayName: rawDisplayName,
matrixId: UserIdentifier.getDisplayUserIdentifier(mxid, {
withDisplayName: true,
roomId: member.roomId
}),
matrixId: identifier,
});
}

const displayNameClasses = classNames({
const displayNameClasses = classNames(colorClass, {
mx_DisambiguatedProfile_displayName: emphasizeDisplayName,
[colorClass]: true,
});

return (
Expand Down

0 comments on commit c46b10b

Please sign in to comment.