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; } = post;
const isThread = const isThread =
(inReplyToId && inReplyToAccountId === account.id) || !!_thread; (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 postText = content ? statusPeek(post) : '';
const showPostContent = !spoilerText || readingExpandSpoilers;
return ( return (
<div class="post-peek" title={!spoilerText ? postText : ''}> <div class="post-peek" title={!spoilerText ? postText : ''}>
<span class="post-peek-content"> <span class="post-peek-content">
{!!filterInfo ? ( {isThread && !showPostContent && (
<>
{isThread && (
<> <>
<span class="post-peek-tag post-peek-thread">Thread</span>{' '} <span class="post-peek-tag post-peek-thread">Thread</span>{' '}
</> </>
)} )}
{!!filterInfo ? (
<span class="post-peek-filtered"> <span class="post-peek-filtered">
Filtered{filterInfo?.titlesStr ? `: ${filterInfo.titlesStr}` : ''} Filtered{filterInfo?.titlesStr ? `: ${filterInfo.titlesStr}` : ''}
</span> </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"> <div class="post-peek-html">
{isThread && ( {isThread && (
<> <>
@ -1735,6 +1740,8 @@ function PostPeek({ post, filterInfo }) {
)} )}
</div> </div>
)} )}
</>
)}
</span> </span>
{!filterInfo && ( {!filterInfo && (
<span class="post-peek-post-content"> <span class="post-peek-post-content">