1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-11-05 00:19:59 +00:00

fix: get server name from acct

This commit is contained in:
三咲智子 2022-12-04 15:18:11 +08:00
parent 218aefeec1
commit 7760d03f9d
No known key found for this signature in database
GPG key ID: 69992F2250DFD93E

View file

@ -28,10 +28,6 @@ export const STATUS_VISIBILITIES = [
},
] as const
export function getServerName(account: Account) {
return account.url.match(UserLinkRE)?.[1] || currentUser.value?.server || ''
}
export function getDisplayName(account?: Account, options?: { rich?: boolean }) {
const displayName = account?.displayName || account?.username || ''
if (options?.rich)
@ -45,6 +41,12 @@ export function getShortHandle({ acct }: Account) {
return `@${acct.includes('@') ? acct.split('@')[0] : acct}`
}
export function getServerName(account: Account) {
if (account.acct.includes('@'))
return account.acct.split('@')[1]
return account.url.match(UserLinkRE)?.[1] || currentUser.value?.server || ''
}
export function getFullHandle(account: Account) {
const handle = `@${account.acct}`
if (!currentUser.value || account.acct.includes('@'))