feat: hide status from suspended account (#1967)

This commit is contained in:
Shinigami 2023-04-16 14:22:03 +02:00 committed by GitHub
parent ce5e81e160
commit 3442dfe75d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 72 additions and 47 deletions

View file

@ -65,6 +65,8 @@ const isDM = $computed(() => status.visibility === 'direct')
const showUpperBorder = $computed(() => props.newer && !directReply) const showUpperBorder = $computed(() => props.newer && !directReply)
const showReplyTo = $computed(() => !replyToMain && !directReply) const showReplyTo = $computed(() => !replyToMain && !directReply)
const forceShow = ref(false)
</script> </script>
<template> <template>
@ -114,60 +116,75 @@ const showReplyTo = $computed(() => !replyToMain && !directReply)
</slot> </slot>
<div flex gap-3 :class="{ 'text-secondary': inNotification }"> <div flex gap-3 :class="{ 'text-secondary': inNotification }">
<!-- Avatar --> <template v-if="status.account.suspended && !forceShow">
<div relative> <div flex="~col 1" min-w-0>
<div v-if="collapseRebloggedBy" absolute flex items-center justify-center top--6px px-2px py-3px rounded-full bg-base> <p italic>
<div i-ri:repeat-fill text-green w-16px h-16px /> {{ $t('status.account.suspended_message') }}
</p>
<div>
<button p-0 flex="~ center" gap-2 text-sm btn-text @click="forceShow = true">
<div i-ri:eye-line />
<span>{{ $t('status.account.suspended_show') }}</span>
</button>
</div>
</div> </div>
<AccountHoverWrapper :account="status.account"> </template>
<NuxtLink :to="getAccountRoute(status.account)" rounded-full> <template v-else>
<AccountBigAvatar :account="status.account" /> <!-- Avatar -->
</NuxtLink> <div relative>
</AccountHoverWrapper> <div v-if="collapseRebloggedBy" absolute flex items-center justify-center top--6px px-2px py-3px rounded-full bg-base>
<div i-ri:repeat-fill text-green w-16px h-16px />
<div v-if="connectReply" w-full h-full flex mt--3px justify-center> </div>
<div w-1px border="x base" />
</div>
</div>
<!-- Main -->
<div flex="~ col 1" min-w-0>
<!-- Account Info -->
<div flex items-center space-x-1>
<AccountHoverWrapper :account="status.account"> <AccountHoverWrapper :account="status.account">
<StatusAccountDetails :account="status.account" /> <NuxtLink :to="getAccountRoute(status.account)" rounded-full>
<AccountBigAvatar :account="status.account" />
</NuxtLink>
</AccountHoverWrapper> </AccountHoverWrapper>
<div flex-auto />
<div v-show="!userSettings.zenMode" text-sm text-secondary flex="~ row nowrap" hover:underline whitespace-nowrap> <div v-if="connectReply" w-full h-full flex mt--3px justify-center>
<AccountBotIndicator v-if="status.account.bot" me-2 /> <div w-1px border="x base" />
<div flex="~ gap1" items-center> </div>
<StatusVisibilityIndicator v-if="status.visibility !== 'public'" :status="status" /> </div>
<div flex>
<CommonTooltip :content="createdAt"> <!-- Main -->
<NuxtLink :title="status.createdAt" :href="statusRoute.href" @click.prevent="go($event)"> <div flex="~ col 1" min-w-0>
<time text-sm ws-nowrap hover:underline :datetime="status.createdAt"> <!-- Account Info -->
{{ timeago }} <div flex items-center space-x-1>
</time> <AccountHoverWrapper :account="status.account">
</NuxtLink> <StatusAccountDetails :account="status.account" />
</CommonTooltip> </AccountHoverWrapper>
<StatusEditIndicator :status="status" inline /> <div flex-auto />
<div v-show="!userSettings.zenMode" text-sm text-secondary flex="~ row nowrap" hover:underline whitespace-nowrap>
<AccountBotIndicator v-if="status.account.bot" me-2 />
<div flex="~ gap1" items-center>
<StatusVisibilityIndicator v-if="status.visibility !== 'public'" :status="status" />
<div flex>
<CommonTooltip :content="createdAt">
<NuxtLink :title="status.createdAt" :href="statusRoute.href" @click.prevent="go($event)">
<time text-sm ws-nowrap hover:underline :datetime="status.createdAt">
{{ timeago }}
</time>
</NuxtLink>
</CommonTooltip>
<StatusEditIndicator :status="status" inline />
</div>
</div> </div>
</div> </div>
<StatusActionsMore v-if="actions !== false" :status="status" me--2 />
</div> </div>
<StatusActionsMore v-if="actions !== false" :status="status" me--2 />
</div>
<!-- Content --> <!-- Content -->
<StatusContent <StatusContent
:status="status" :status="status"
:newer="newer" :newer="newer"
:context="context" :context="context"
:is-preview="isPreview" :is-preview="isPreview"
:in-notification="inNotification" :in-notification="inNotification"
mb2 :class="{ 'mt-2 mb1': isDM }" mb2 :class="{ 'mt-2 mb1': isDM }"
/> />
<StatusActions v-if="actions !== false" v-show="!userSettings.zenMode" :status="status" /> <StatusActions v-if="actions !== false" v-show="!userSettings.zenMode" :status="status" />
</div> </div>
</template>
</div> </div>
</StatusLink> </StatusLink>
</template> </template>

View file

@ -385,6 +385,10 @@
"uploading": "Hochladen..." "uploading": "Hochladen..."
}, },
"status": { "status": {
"account": {
"suspended_message": "Der Account dieses Status wurde vorübergehend gesperrt.",
"suspended_show": "Inhalt trotzdem anzeigen?"
},
"boosted_by": "Boosted von", "boosted_by": "Boosted von",
"edited": "Zuletzt bearbeitet: {0}", "edited": "Zuletzt bearbeitet: {0}",
"favourited_by": "Favorisiert von", "favourited_by": "Favorisiert von",

View file

@ -497,6 +497,10 @@
"uploading": "Uploading..." "uploading": "Uploading..."
}, },
"status": { "status": {
"account": {
"suspended_message": "The account of this status has been suspended.",
"suspended_show": "Show content anyways?"
},
"boosted_by": "Boosted By", "boosted_by": "Boosted By",
"edited": "Edited {0}", "edited": "Edited {0}",
"favourited_by": "Favorited By", "favourited_by": "Favorited By",