diff --git a/src/components/name-text.jsx b/src/components/name-text.jsx index f6b93ca9..8367446e 100644 --- a/src/components/name-text.jsx +++ b/src/components/name-text.jsx @@ -19,15 +19,16 @@ function NameText({ const displayNameWithEmoji = emojifyText(displayName, emojis); + const trimmedUsername = username.toLowerCase().trim(); + const trimmedDisplayName = (displayName || '').toLowerCase().trim(); + if ( - !short && - username.toLowerCase().trim() === - (displayName || '') + (!short && trimmedUsername === trimmedDisplayName) || + trimmedUsername === + trimmedDisplayName .replace(/(\:(\w|\+|\-)+\:)(?=|[\!\.\?]|$)/g, '') // Remove shortcodes, regex from https://regex101.com/r/iE9uV0/1 .replace(/\s+/g, '') // E.g. "My name" === "myname" .replace(/[^a-z0-9]/gi, '') // Remove non-alphanumeric characters - .toLowerCase() - .trim() ) { username = null; }