mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-01-23 17:16:26 +01:00
Respect 'reading:expand:spoilers' pref
Note this doesn't follow 'reading:expand:media' pref separately, so media will be spoiled too
This commit is contained in:
parent
fa145d3ed0
commit
fce5e45bc9
1 changed files with 12 additions and 2 deletions
|
@ -228,7 +228,12 @@ function Status({
|
|||
inReplyToAccountId === currentAccount ||
|
||||
mentions?.find((mention) => mention.id === currentAccount);
|
||||
|
||||
const showSpoiler = previewMode || !!snapStates.spoilers[id] || false;
|
||||
const readingExpandSpoilers = useMemo(() => {
|
||||
const prefs = store.account.get('preferences') || {};
|
||||
return !!prefs['reading:expand:spoilers'];
|
||||
}, []);
|
||||
const showSpoiler =
|
||||
previewMode || readingExpandSpoilers || !!snapStates.spoilers[id] || false;
|
||||
|
||||
if (reblog) {
|
||||
// If has statusID, means useItemID (cached in states)
|
||||
|
@ -1128,6 +1133,7 @@ function Status({
|
|||
<button
|
||||
class={`light spoiler ${showSpoiler ? 'spoiling' : ''}`}
|
||||
type="button"
|
||||
disabled={readingExpandSpoilers}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
@ -1139,7 +1145,11 @@ function Status({
|
|||
}}
|
||||
>
|
||||
<Icon icon={showSpoiler ? 'eye-open' : 'eye-close'} />{' '}
|
||||
{showSpoiler ? 'Show less' : 'Show more'}
|
||||
{readingExpandSpoilers
|
||||
? 'Content warning'
|
||||
: showSpoiler
|
||||
? 'Show less'
|
||||
: 'Show more'}
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
|
|
Loading…
Reference in a new issue