mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-02 06:06:41 +01:00
Add one more username ≈ display name logic
This commit is contained in:
parent
9aa2bac685
commit
ef712c62a9
1 changed files with 7 additions and 6 deletions
|
@ -31,16 +31,17 @@ function NameText({
|
|||
.replace(/(\:(\w|\+|\-)+\:)(?=|[\!\.\?]|$)/g, '') // Remove shortcodes, regex from https://regex101.com/r/iE9uV0/1
|
||||
.replace(/\s+/g, ''); // E.g. "My name" === "myname"
|
||||
const shortenedAlphaNumericDisplayName = shortenedDisplayName.replace(
|
||||
/[^a-z0-9]/gi,
|
||||
/[^a-z0-9@\.]/gi,
|
||||
'',
|
||||
); // Remove non-alphanumeric characters
|
||||
|
||||
if (
|
||||
!short &&
|
||||
(trimmedUsername === trimmedDisplayName ||
|
||||
trimmedUsername === shortenedDisplayName ||
|
||||
trimmedUsername === shortenedAlphaNumericDisplayName ||
|
||||
nameCollator.compare(trimmedUsername, shortenedDisplayName) === 0)
|
||||
(!short &&
|
||||
(trimmedUsername === trimmedDisplayName ||
|
||||
trimmedUsername === shortenedDisplayName ||
|
||||
trimmedUsername === shortenedAlphaNumericDisplayName ||
|
||||
nameCollator.compare(trimmedUsername, shortenedDisplayName) === 0)) ||
|
||||
shortenedAlphaNumericDisplayName === acct.toLowerCase()
|
||||
) {
|
||||
username = null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue