Fix displayname calculation around RTL / unhomoglyth. (#2953)

This commit is contained in:
Will Hunt
2025-01-16 17:26:58 +00:00
committed by GitHub
parent 723fa290ff
commit 3189bdba2a
4 changed files with 24 additions and 15 deletions

View File

@@ -45,7 +45,11 @@ export function shouldDisambiguate(
// NOTE: We *should* have a room member for everyone.
.filter((m) => !!m)
.filter((m) => m.userId !== userId)
.some((m) => calculateDisplayName(m, false) === strippedDisplayName)
.some(
(m) =>
removeHiddenChars(calculateDisplayName(m, false)) ===
strippedDisplayName,
)
);
}
@@ -56,9 +60,7 @@ export function calculateDisplayName(
const { rawDisplayName: displayName, userId } = member;
if (!displayName || displayName === userId) return userId;
const resultDisplayname = removeDirectionOverrideChars(
removeHiddenChars(displayName),
);
const resultDisplayname = removeDirectionOverrideChars(displayName);
if (disambiguate) return resultDisplayname + " (" + userId + ")";