2022-12-26 16:37:42 +09:00
|
|
|
<script setup lang="ts">
|
2023-01-08 15:21:09 +09:00
|
|
|
import type { mastodon } from 'masto'
|
2022-12-26 16:37:42 +09:00
|
|
|
|
|
|
|
const { status, context } = defineProps<{
|
2023-01-08 15:21:09 +09:00
|
|
|
status: mastodon.v1.Status
|
2023-01-19 00:59:37 +09:00
|
|
|
newer?: mastodon.v1.Status
|
2023-01-08 15:21:09 +09:00
|
|
|
context?: mastodon.v2.FilterContext | 'details'
|
2023-02-15 19:34:23 +09:00
|
|
|
isPreview?: boolean
|
2023-03-20 05:55:19 +09:00
|
|
|
inNotification?: boolean
|
2022-12-26 16:37:42 +09:00
|
|
|
}>()
|
|
|
|
|
2024-02-22 00:20:08 +09:00
|
|
|
const isDM = computed(() => status.visibility === 'direct')
|
|
|
|
const isDetails = computed(() => context === 'details')
|
2022-12-26 16:37:42 +09:00
|
|
|
|
|
|
|
// Content Filter logic
|
2024-02-22 00:20:08 +09:00
|
|
|
const filterResult = computed(() => status.filtered?.length ? status.filtered[0] : null)
|
|
|
|
const filter = computed(() => filterResult.value?.filter)
|
2022-12-26 16:37:42 +09:00
|
|
|
|
2024-02-22 00:20:08 +09:00
|
|
|
const filterPhrase = computed(() => filter.value?.title)
|
|
|
|
const isFiltered = computed(() => status.account.id !== currentUser.value?.account.id && filterPhrase && context && context !== 'details' && !!filter.value?.context.includes(context))
|
2023-02-06 00:05:42 +09:00
|
|
|
|
|
|
|
// check spoiler text or media attachment
|
|
|
|
// needed to handle accounts that mark all their posts as sensitive
|
2024-02-22 00:20:08 +09:00
|
|
|
const spoilerTextPresent = computed(() => !!status.spoilerText && status.spoilerText.trim().length > 0)
|
|
|
|
const hasSpoilerOrSensitiveMedia = computed(() => spoilerTextPresent.value || (status.sensitive && !!status.mediaAttachments.length))
|
2023-05-06 18:26:16 +09:00
|
|
|
const isSensitiveNonSpoiler = computed(() => status.sensitive && !status.spoilerText && !!status.mediaAttachments.length)
|
2023-05-06 01:12:07 +09:00
|
|
|
const hideAllMedia = computed(
|
|
|
|
() => {
|
2023-11-07 18:57:44 +09:00
|
|
|
return currentUser.value ? (getHideMediaByDefault(currentUser.value.account) && (!!status.mediaAttachments.length || !!status.card?.html)) : false
|
2023-05-06 01:12:07 +09:00
|
|
|
},
|
|
|
|
)
|
2024-02-22 00:20:08 +09:00
|
|
|
const embeddedMediaPreference = usePreferences('experimentalEmbeddedMedia')
|
2024-03-05 01:01:56 +09:00
|
|
|
const allowEmbeddedMedia = computed(() => status.card?.html && embeddedMediaPreference.value)
|
2022-12-26 16:37:42 +09:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div
|
|
|
|
space-y-3
|
|
|
|
:class="{
|
2024-04-06 01:23:52 +09:00
|
|
|
'py2 px3.5 bg-dm rounded-4 me--1': isDM,
|
2023-01-04 01:25:43 +09:00
|
|
|
'ms--3.5 mt--1 ms--1': isDM && context !== 'details',
|
2022-12-26 16:37:42 +09:00
|
|
|
}"
|
|
|
|
>
|
2023-05-06 01:12:07 +09:00
|
|
|
<StatusBody v-if="(!isFiltered && isSensitiveNonSpoiler) || hideAllMedia" :status="status" :newer="newer" :with-action="!isDetails" :class="isDetails ? 'text-xl' : ''" />
|
|
|
|
<StatusSpoiler :enabled="hasSpoilerOrSensitiveMedia || isFiltered" :filter="isFiltered" :sensitive-non-spoiler="isSensitiveNonSpoiler || hideAllMedia" :is-d-m="isDM">
|
2023-05-10 20:17:58 +09:00
|
|
|
<template v-if="spoilerTextPresent" #spoiler>
|
2024-04-21 14:25:40 +09:00
|
|
|
<p>
|
|
|
|
<ContentRich :content="status.spoilerText" :emojis="status.emojis" :markdown="false" />
|
|
|
|
</p>
|
2022-12-30 01:31:04 +09:00
|
|
|
</template>
|
2023-02-06 00:05:42 +09:00
|
|
|
<template v-else-if="filterPhrase" #spoiler>
|
|
|
|
<p>{{ `${$t('status.filter_hidden_phrase')}: ${filterPhrase}` }}</p>
|
|
|
|
</template>
|
2023-05-06 01:12:07 +09:00
|
|
|
<StatusBody v-if="!(isSensitiveNonSpoiler || hideAllMedia)" :status="status" :newer="newer" :with-action="!isDetails" :class="isDetails ? 'text-xl' : ''" />
|
2023-01-16 18:55:00 +09:00
|
|
|
<StatusTranslation :status="status" />
|
2022-12-28 20:49:47 +09:00
|
|
|
<StatusPoll v-if="status.poll" :status="status" />
|
2022-12-26 16:37:42 +09:00
|
|
|
<StatusMedia
|
|
|
|
v-if="status.mediaAttachments?.length"
|
|
|
|
:status="status"
|
2023-02-15 19:34:23 +09:00
|
|
|
:is-preview="isPreview"
|
2022-12-26 16:37:42 +09:00
|
|
|
/>
|
|
|
|
<StatusPreviewCard
|
2023-11-07 18:57:44 +09:00
|
|
|
v-if="status.card && !allowEmbeddedMedia"
|
2022-12-26 16:37:42 +09:00
|
|
|
:card="status.card"
|
|
|
|
:small-picture-only="status.mediaAttachments?.length > 0"
|
|
|
|
/>
|
2023-11-07 18:57:44 +09:00
|
|
|
<StatusEmbeddedMedia v-if="allowEmbeddedMedia" :status="status" />
|
2022-12-26 16:37:42 +09:00
|
|
|
<StatusCard
|
|
|
|
v-if="status.reblog"
|
|
|
|
:status="status.reblog" border="~ rounded"
|
|
|
|
:actions="false"
|
|
|
|
/>
|
|
|
|
</StatusSpoiler>
|
|
|
|
</div>
|
|
|
|
</template>
|