Fix undefined in account link when ctrl-clicking

This commit is contained in:
Lim Chee Aun 2024-06-18 20:14:56 +08:00
parent 497ede1a3d
commit 93bb1da7c9

View file

@ -2,6 +2,7 @@ import './name-text.css';
import { memo } from 'preact/compat'; import { memo } from 'preact/compat';
import { api } from '../utils/api';
import states from '../utils/states'; import states from '../utils/states';
import Avatar from './avatar'; import Avatar from './avatar';
@ -33,6 +34,8 @@ function NameText({
} = account; } = account;
const [_, acct1, acct2] = acct.match(/([^@]+)(@.+)/i) || [, acct]; const [_, acct1, acct2] = acct.match(/([^@]+)(@.+)/i) || [, acct];
if (!instance) instance = api().instance;
const trimmedUsername = username.toLowerCase().trim(); const trimmedUsername = username.toLowerCase().trim();
const trimmedDisplayName = (displayName || '').toLowerCase().trim(); const trimmedDisplayName = (displayName || '').toLowerCase().trim();
const shortenedDisplayName = trimmedDisplayName const shortenedDisplayName = trimmedDisplayName