diff --git a/components/account/AccountHeader.vue b/components/account/AccountHeader.vue
index 78281b58..9d486fd6 100644
--- a/components/account/AccountHeader.vue
+++ b/components/account/AccountHeader.vue
@@ -66,7 +66,7 @@ function previewAvatar() {
{{ accountHandle }}
diff --git a/composables/masto.ts b/composables/masto.ts index caf04639..21380229 100644 --- a/composables/masto.ts +++ b/composables/masto.ts @@ -39,8 +39,12 @@ export function getServerName(account: Account) { return account.url.match(UserLinkRE)?.[1] || currentUser.value?.server || '' } -export function getDisplayName(account: Account) { - return account.displayName || account.username +export function getDisplayName(account?: Account, options?: { rich?: boolean }) { + const displayName = account?.displayName || account?.username || '' + if (options?.rich) + return displayName + + return displayName.replace(/:([\w-]+?):/g, '') } export function getShortHandle(account: Account) { diff --git a/pages/@[account]/[status].vue b/pages/@[account]/[status].vue index ed3288c3..96141732 100644 --- a/pages/@[account]/[status].vue +++ b/pages/@[account]/[status].vue @@ -23,7 +23,7 @@ const { data: context } = useAsyncData(`context:${id}`, () => masto.statuses.fet v-if="currentUser" border="t base" :draft-key="`reply-${id}`" - :placeholder="`Reply to ${status?.account ? getDisplayName(status?.account) : 'this thread'}`" + :placeholder="`Reply to ${status?.account ? getDisplayName(status.account) : 'this thread'}`" :in-reply-to-id="id" /> diff --git a/pages/@[account]/index.vue b/pages/@[account]/index.vue index e57415f1..05c40d19 100644 --- a/pages/@[account]/index.vue +++ b/pages/@[account]/index.vue @@ -6,7 +6,7 @@ const account = await fetchAccountByName(accountName).catch(() => null) if (account) { useHead({ - title: () => `${account.displayName?.replace(/\:\w+\:/g, '') ?? ''} (@${account.acct})`, + title: () => `${getDisplayName(account)} (@${account.acct})`, }) }