From ba11402435a709c2279411704611f94c5bef51fc Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 15 Jun 2020 14:40:35 +0200 Subject: [PATCH] Fix global search nsfw policy when logged in --- server/controllers/api/search.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 // Use the default instance NSFW policy if not specified if (!body.nsfw) { - body.nsfw = CONFIG.INSTANCE.DEFAULT_NSFW_POLICY === 'do_not_list' + const nsfwPolicy = res.locals.oauth + ? res.locals.oauth.token.User.nsfwPolicy + : CONFIG.INSTANCE.DEFAULT_NSFW_POLICY + + body.nsfw = nsfwPolicy === 'do_not_list' ? 'false' : 'both' } -- 2.25.1