support pages being nsfw only even if they have a "sfw" image
This commit is contained in:
parent
d14571ec3e
commit
29a4d033a8
1 changed files with 3 additions and 1 deletions
|
@ -37,6 +37,7 @@ data Info =
|
|||
date :: !Day,
|
||||
title :: !Text,
|
||||
artist :: !(Maybe Artist), -- nothing = me, obv
|
||||
nsfwOnly :: !Bool,
|
||||
tags :: ![Text],
|
||||
nsfwTags :: ![Text],
|
||||
desc :: !(Maybe Text),
|
||||
|
@ -146,6 +147,7 @@ instance FromYAML Info where
|
|||
Info <$> m .: "date"
|
||||
<*> m .: "title"
|
||||
<*> m .:? "artist"
|
||||
<*> m .:? "nsfw-only" .!= False
|
||||
<*> m .:? "tags" .!= []
|
||||
<*> m .:? "nsfw-tags" .!= []
|
||||
<*> m .:? "desc"
|
||||
|
@ -227,7 +229,7 @@ readNsfwFilter "all" = pure AllN
|
|||
readNsfwFilter _ = empty
|
||||
|
||||
matchNsfw :: NsfwFilter -> Info -> Bool
|
||||
matchNsfw NoNsfw i = #anySfw i
|
||||
matchNsfw NoNsfw i = #anySfw i && not (#nsfwOnly i)
|
||||
matchNsfw OnlyNsfw i = #anyNsfw i
|
||||
matchNsfw AllN _ = True
|
||||
|
||||
|
|
Loading…
Reference in a new issue