aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/search.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-06-15 14:40:35 +0200
committerChocobozzz <me@florianbigard.com>2020-06-15 15:04:51 +0200
commitba11402435a709c2279411704611f94c5bef51fc (patch)
tree78ebd6ec040390b4887de4a4679a162afaa3c92d /server/controllers/api/search.ts
parent228393302d98136d4dc35c5f197edc8cebd5d64f (diff)
downloadPeerTube-ba11402435a709c2279411704611f94c5bef51fc.tar.gz
PeerTube-ba11402435a709c2279411704611f94c5bef51fc.tar.zst
PeerTube-ba11402435a709c2279411704611f94c5bef51fc.zip
Fix global search nsfw policy when logged in
Diffstat (limited to 'server/controllers/api/search.ts')
-rw-r--r--server/controllers/api/search.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/server/controllers/api/search.ts b/server/controllers/api/search.ts
index e35a7346e..a0da5e30c 100644
--- a/server/controllers/api/search.ts
+++ b/server/controllers/api/search.ts
@@ -173,7 +173,11 @@ async function searchVideosIndex (query: VideosSearchQuery, res: express.Respons
173 173
174 // Use the default instance NSFW policy if not specified 174 // Use the default instance NSFW policy if not specified
175 if (!body.nsfw) { 175 if (!body.nsfw) {
176 body.nsfw = CONFIG.INSTANCE.DEFAULT_NSFW_POLICY === 'do_not_list' 176 const nsfwPolicy = res.locals.oauth
177 ? res.locals.oauth.token.User.nsfwPolicy
178 : CONFIG.INSTANCE.DEFAULT_NSFW_POLICY
179
180 body.nsfw = nsfwPolicy === 'do_not_list'
177 ? 'false' 181 ? 'false'
178 : 'both' 182 : 'both'
179 } 183 }