From c1e89582f8379dc9167617cfaa7219c997917e18 Mon Sep 17 00:00:00 2001 From: Shinigami Date: Wed, 11 Jan 2023 18:47:36 +0100 Subject: [PATCH] fix: remove emoji in status title (#932) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 三咲智子 Kevin Deng --- components/status/StatusDetails.vue | 2 +- composables/masto/account.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/status/StatusDetails.vue b/components/status/StatusDetails.vue index dd53bcda..1d927e60 100644 --- a/components/status/StatusDetails.vue +++ b/components/status/StatusDetails.vue @@ -20,7 +20,7 @@ const createdAt = useFormattedDateTime(status.createdAt) const { t } = useI18n() useHeadFixed({ - title: () => `${status.account.displayName || status.account.acct} ${t('common.in')} ${t('app_name')}: "${removeHTMLTags(status.content) || ''}"`, + title: () => `${getDisplayName(status.account)} ${t('common.in')} ${t('app_name')}: "${removeHTMLTags(status.content) || ''}"`, }) const isDM = $computed(() => status.visibility === 'direct') diff --git a/composables/masto/account.ts b/composables/masto/account.ts index 8b47ac69..a5736a08 100644 --- a/composables/masto/account.ts +++ b/composables/masto/account.ts @@ -1,7 +1,7 @@ import type { mastodon } from 'masto' -export function getDisplayName(account?: mastodon.v1.Account, options?: { rich?: boolean }) { - const displayName = account?.displayName || account?.username || '' +export function getDisplayName(account: mastodon.v1.Account, options?: { rich?: boolean }) { + const displayName = account.displayName || account.username || account.acct || '' if (options?.rich) return displayName return displayName.replace(/:([\w-]+?):/g, '')