From: Chocobozzz Date: Mon, 15 Jun 2020 12:40:35 +0000 (+0200) Subject: Fix global search nsfw policy when logged in X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ba11402435a709c2279411704611f94c5bef51fc;p=oweals%2Fpeertube.git Fix global search nsfw policy when logged in --- 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' }