mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-14 04:08:32 +03:00
Fix conditions not scoped properly
This commit is contained in:
parent
11d74b3258
commit
75b6cddb04
1 changed files with 7 additions and 6 deletions
|
@ -21,14 +21,15 @@ function NameText({
|
|||
|
||||
const trimmedUsername = username.toLowerCase().trim();
|
||||
const trimmedDisplayName = (displayName || '').toLowerCase().trim();
|
||||
const shortenedDisplayName = 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
|
||||
|
||||
if (
|
||||
(!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
|
||||
!short &&
|
||||
(trimmedUsername === trimmedDisplayName ||
|
||||
trimmedUsername === shortenedDisplayName)
|
||||
) {
|
||||
username = null;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue