Respect expand spoiler setting in Catchup

This commit is contained in:
Lim Chee Aun 2024-05-19 16:22:18 +08:00
parent 025a5429cc
commit 7da1745cca

View file

@ -1677,35 +1677,40 @@ function PostPeek({ post, filterInfo }) {
} = post;
const isThread =
(inReplyToId && inReplyToAccountId === account.id) || !!_thread;
const showMedia = !spoilerText && !sensitive;
const readingExpandSpoilers = useMemo(() => {
const prefs = store.account.get('preferences') || {};
return !!prefs['reading:expand:spoilers'];
}, []);
// const readingExpandSpoilers = true;
const showMedia = readingExpandSpoilers || (!spoilerText && !sensitive);
const postText = content ? statusPeek(post) : '';
const showPostContent = !spoilerText || readingExpandSpoilers;
return (
<div class="post-peek" title={!spoilerText ? postText : ''}>
<span class="post-peek-content">
{!!filterInfo ? (
<>
{isThread && (
{isThread && !showPostContent && (
<>
<span class="post-peek-tag post-peek-thread">Thread</span>{' '}
</>
)}
{!!filterInfo ? (
<span class="post-peek-filtered">
Filtered{filterInfo?.titlesStr ? `: ${filterInfo.titlesStr}` : ''}
</span>
</>
) : !!spoilerText ? (
<>
{isThread && (
<>
<span class="post-peek-tag post-peek-thread">Thread</span>{' '}
</>
)}
<span class="post-peek-spoiler">
<Icon icon="eye-close" /> {spoilerText}
</span>
</>
) : (
<>
{!!spoilerText && (
<span class="post-peek-spoiler">
<Icon
icon={`${readingExpandSpoilers ? 'eye-open' : 'eye-close'}`}
/>{' '}
{spoilerText}
</span>
)}
{showPostContent && (
<div class="post-peek-html">
{isThread && (
<>
@ -1735,6 +1740,8 @@ function PostPeek({ post, filterInfo }) {
)}
</div>
)}
</>
)}
</span>
{!filterInfo && (
<span class="post-peek-post-content">