forked from Mirrors/elk
fix: get server name from acct
This commit is contained in:
parent
218aefeec1
commit
7760d03f9d
1 changed files with 6 additions and 4 deletions
|
@ -28,10 +28,6 @@ export const STATUS_VISIBILITIES = [
|
||||||
},
|
},
|
||||||
] as const
|
] as const
|
||||||
|
|
||||||
export function getServerName(account: Account) {
|
|
||||||
return account.url.match(UserLinkRE)?.[1] || currentUser.value?.server || ''
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getDisplayName(account?: Account, options?: { rich?: boolean }) {
|
export function getDisplayName(account?: Account, options?: { rich?: boolean }) {
|
||||||
const displayName = account?.displayName || account?.username || ''
|
const displayName = account?.displayName || account?.username || ''
|
||||||
if (options?.rich)
|
if (options?.rich)
|
||||||
|
@ -45,6 +41,12 @@ export function getShortHandle({ acct }: Account) {
|
||||||
return `@${acct.includes('@') ? acct.split('@')[0] : acct}`
|
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) {
|
export function getFullHandle(account: Account) {
|
||||||
const handle = `@${account.acct}`
|
const handle = `@${account.acct}`
|
||||||
if (!currentUser.value || account.acct.includes('@'))
|
if (!currentUser.value || account.acct.includes('@'))
|
||||||
|
|
Loading…
Reference in a new issue