fix: wrap non-sensitive spoilers in spoiler status (#1864)

This commit is contained in:
Zaidhaan 2023-03-08 02:41:00 +08:00 committed by GitHub
parent bc09a28af6
commit 69c1bd8b6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,7 +20,7 @@ const isFiltered = $computed(() => status.account.id !== currentUser.value?.acco
// check spoiler text or media attachment // check spoiler text or media attachment
// needed to handle accounts that mark all their posts as sensitive // needed to handle accounts that mark all their posts as sensitive
const hasSensitiveSpoilerOrMedia = $computed(() => status.sensitive && (!!status.spoilerText || !!status.mediaAttachments.length)) const hasSpoilerOrSensitiveMedia = $computed(() => !!status.spoilerText || (status.sensitive && !!status.mediaAttachments.length))
</script> </script>
<template> <template>
@ -32,7 +32,7 @@ const hasSensitiveSpoilerOrMedia = $computed(() => status.sensitive && (!!status
}" }"
> >
<StatusBody v-if="!isFiltered && status.sensitive && !status.spoilerText" :status="status" :newer="newer" :with-action="!isDetails" :class="isDetails ? 'text-xl' : ''" /> <StatusBody v-if="!isFiltered && status.sensitive && !status.spoilerText" :status="status" :newer="newer" :with-action="!isDetails" :class="isDetails ? 'text-xl' : ''" />
<StatusSpoiler :enabled="hasSensitiveSpoilerOrMedia || isFiltered" :filter="isFiltered" :is-d-m="isDM"> <StatusSpoiler :enabled="hasSpoilerOrSensitiveMedia || isFiltered" :filter="isFiltered" :is-d-m="isDM">
<template v-if="status.spoilerText" #spoiler> <template v-if="status.spoilerText" #spoiler>
<p>{{ status.spoilerText }}</p> <p>{{ status.spoilerText }}</p>
</template> </template>