feat: hide profile when blocked

This commit is contained in:
三咲智子 2022-12-05 00:50:38 +08:00
parent 1476438d73
commit f33b6b58cd
No known key found for this signature in database
GPG key ID: 69992F2250DFD93E
4 changed files with 13 additions and 5 deletions

View file

@ -1,6 +1,7 @@
{
"account": {
"avatar_description": "{0}'s avatar",
"blocked_by": "You're blocked by this user.",
"blocked_domains": "Blocked domains",
"blocked_users": "Blocked users",
"favourites": "Favourites",

View file

@ -1,6 +1,7 @@
{
"account": {
"avatar_description": "{0}的头像",
"blocked_by": "您已被此用户拉黑",
"blocked_domains": "已拉黑的域名",
"blocked_users": "已拉黑的用户",
"favourites": "喜欢的帖文",

View file

@ -5,6 +5,7 @@ const accountName = $(computedEager(() => toShortHandle(params.account as string
const { t } = useI18n()
const { data: account, refresh } = $(await useAsyncData(() => fetchAccountByHandle(accountName).catch(() => null)))
const relationship = $computed(() => account ? useRelationship(account).value : undefined)
if (account) {
useHeadFixed({
@ -27,7 +28,16 @@ onReactivated(() => {
<template v-if="account">
<AccountHeader :account="account" command border="b base" />
<NuxtPage />
<div v-if="relationship?.blockedBy" h-30 flex="~ col center gap-2">
<div text-secondary>
{{ $t('account.profile_unavailable') }}
</div>
<div text-secondary-light text-sm>
{{ $t('account.blocked_by') }}
</div>
</div>
<NuxtPage v-else />
</template>
<CommonNotFound v-else>

View file

@ -43,10 +43,6 @@ const paginator = $computed(() => tabs.find(t => t.name === tab)!.paginator)
</script>
<template>
<!-- TODO figure out when profile is unavailable -->
<!-- <div v-if="(account!.discoverable === false)" h-30 flex="~ center" text-secondary-light>
{{ $t('account.profile_unavailable') }}
</div> -->
<div>
<CommonTabs v-model="tab" :options="tabs" command />
<KeepAlive>