fix: remove emoji in status title (#932)

Co-authored-by: 三咲智子 Kevin Deng <sxzz@sxzz.moe>
This commit is contained in:
Shinigami 2023-01-11 18:47:36 +01:00 committed by GitHub
parent c2850a34ae
commit c1e89582f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -20,7 +20,7 @@ const createdAt = useFormattedDateTime(status.createdAt)
const { t } = useI18n() const { t } = useI18n()
useHeadFixed({ 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') const isDM = $computed(() => status.visibility === 'direct')

View file

@ -1,7 +1,7 @@
import type { mastodon } from 'masto' import type { mastodon } from 'masto'
export function getDisplayName(account?: mastodon.v1.Account, options?: { rich?: boolean }) { export function getDisplayName(account: mastodon.v1.Account, options?: { rich?: boolean }) {
const displayName = account?.displayName || account?.username || '' const displayName = account.displayName || account.username || account.acct || ''
if (options?.rich) if (options?.rich)
return displayName return displayName
return displayName.replace(/:([\w-]+?):/g, '') return displayName.replace(/:([\w-]+?):/g, '')