mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-25 10:45:41 +03:00
Fix NameText not showing username when short
This commit is contained in:
parent
ef1abbc25c
commit
3fbecb2f0d
1 changed files with 14 additions and 9 deletions
|
@ -20,9 +20,17 @@ function NameText({
|
|||
external,
|
||||
onClick,
|
||||
}) {
|
||||
const { acct, avatar, avatarStatic, id, url, displayName, emojis, bot } =
|
||||
account;
|
||||
let { username } = account;
|
||||
const {
|
||||
acct,
|
||||
avatar,
|
||||
avatarStatic,
|
||||
id,
|
||||
url,
|
||||
displayName,
|
||||
emojis,
|
||||
bot,
|
||||
username,
|
||||
} = account;
|
||||
const [_, acct1, acct2] = acct.match(/([^@]+)(@.+)/i) || [, acct];
|
||||
|
||||
const trimmedUsername = username.toLowerCase().trim();
|
||||
|
@ -35,16 +43,13 @@ function NameText({
|
|||
'',
|
||||
); // Remove non-alphanumeric characters
|
||||
|
||||
if (
|
||||
const hideUsername =
|
||||
(!short &&
|
||||
(trimmedUsername === trimmedDisplayName ||
|
||||
trimmedUsername === shortenedDisplayName ||
|
||||
trimmedUsername === shortenedAlphaNumericDisplayName ||
|
||||
nameCollator.compare(trimmedUsername, shortenedDisplayName) === 0)) ||
|
||||
shortenedAlphaNumericDisplayName === acct.toLowerCase()
|
||||
) {
|
||||
username = null;
|
||||
}
|
||||
shortenedAlphaNumericDisplayName === acct.toLowerCase();
|
||||
|
||||
return (
|
||||
<a
|
||||
|
@ -83,7 +88,7 @@ function NameText({
|
|||
<b>
|
||||
<EmojiText text={displayName} emojis={emojis} />
|
||||
</b>
|
||||
{!showAcct && username && (
|
||||
{!showAcct && !hideUsername && (
|
||||
<>
|
||||
{' '}
|
||||
<i>@{username}</i>
|
||||
|
|
Loading…
Reference in a new issue