mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-02 22:26:57 +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 ||
|
inReplyToAccountId === currentAccount ||
|
||||||
mentions?.find((mention) => mention.id === 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 (reblog) {
|
||||||
// If has statusID, means useItemID (cached in states)
|
// If has statusID, means useItemID (cached in states)
|
||||||
|
@ -1128,6 +1133,7 @@ function Status({
|
||||||
<button
|
<button
|
||||||
class={`light spoiler ${showSpoiler ? 'spoiling' : ''}`}
|
class={`light spoiler ${showSpoiler ? 'spoiling' : ''}`}
|
||||||
type="button"
|
type="button"
|
||||||
|
disabled={readingExpandSpoilers}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
@ -1139,7 +1145,11 @@ function Status({
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Icon icon={showSpoiler ? 'eye-open' : 'eye-close'} />{' '}
|
<Icon icon={showSpoiler ? 'eye-open' : 'eye-close'} />{' '}
|
||||||
{showSpoiler ? 'Show less' : 'Show more'}
|
{readingExpandSpoilers
|
||||||
|
? 'Content warning'
|
||||||
|
: showSpoiler
|
||||||
|
? 'Show less'
|
||||||
|
: 'Show more'}
|
||||||
</button>
|
</button>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
Loading…
Reference in a new issue