projects
/
oweals
/
peertube.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2283933
)
Fix global search nsfw policy when logged in
author
Chocobozzz
<me@florianbigard.com>
Mon, 15 Jun 2020 12:40:35 +0000
(14:40 +0200)
committer
Chocobozzz
<me@florianbigard.com>
Mon, 15 Jun 2020 13:04:51 +0000
(15:04 +0200)
server/controllers/api/search.ts
patch
|
blob
|
history
diff --git
a/server/controllers/api/search.ts
b/server/controllers/api/search.ts
index e35a7346e4e905eea7e7699e49a3c8f28a828a8d..a0da5e30cfbee0e3dff45556d7eb762bfee76437 100644
(file)
--- 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'
}