From 7da1745cca1f56b99af53a1348fe8c986fd7514f Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Sun, 19 May 2024 16:22:18 +0800 Subject: [PATCH] Respect expand spoiler setting in Catchup --- src/pages/catchup.jsx | 103 ++++++++++++++++++++++-------------------- 1 file changed, 55 insertions(+), 48 deletions(-) diff --git a/src/pages/catchup.jsx b/src/pages/catchup.jsx index 433eed32..30000bfd 100644 --- a/src/pages/catchup.jsx +++ b/src/pages/catchup.jsx @@ -1677,63 +1677,70 @@ 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 (
+ {isThread && !showPostContent && ( + <> + Thread{' '} + + )} {!!filterInfo ? ( - <> - {isThread && ( - <> - Thread{' '} - - )} - - Filtered{filterInfo?.titlesStr ? `: ${filterInfo.titlesStr}` : ''} - - - ) : !!spoilerText ? ( - <> - {isThread && ( - <> - Thread{' '} - - )} - - {spoilerText} - - + + Filtered{filterInfo?.titlesStr ? `: ${filterInfo.titlesStr}` : ''} + ) : ( -
- {isThread && ( - <> - Thread{' '} - + <> + {!!spoilerText && ( + + {' '} + {spoilerText} + )} - {!!content && ( -
+ {showPostContent && ( +
+ {isThread && ( + <> + Thread{' '} + + )} + {!!content && ( +
+ )} + {!!poll?.options?.length && + poll.options.map((o) => ( +
+ {poll.multiple ? '▪️' : '•'} {o.title} +
+ ))} + {!content && + mediaAttachments?.length === 1 && + mediaAttachments[0].description && ( + <> + ALT{' '} +
{mediaAttachments[0].description}
+ + )} +
)} - {!!poll?.options?.length && - poll.options.map((o) => ( -
- {poll.multiple ? '▪️' : '•'} {o.title} -
- ))} - {!content && - mediaAttachments?.length === 1 && - mediaAttachments[0].description && ( - <> - ALT{' '} -
{mediaAttachments[0].description}
- - )} -
+ )} {!filterInfo && (