]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/api/search.ts
Use raw sql for abuses
[github/Chocobozzz/PeerTube.git] / server / controllers / api / search.ts
index e35a7346e4e905eea7e7699e49a3c8f28a828a8d..2d98b5d34155e84e1872245eb338b0f70c704bff 100644 (file)
@@ -28,7 +28,7 @@ import {
 } from '../../middlewares'
 import { VideoModel } from '../../models/video/video'
 import { VideoChannelModel } from '../../models/video/video-channel'
-import { MChannelAccountDefault, MVideoAccountLightBlacklistAllFiles } from '../../typings/models'
+import { MChannelAccountDefault, MVideoAccountLightBlacklistAllFiles } from '../../types/models'
 
 const searchRouter = express.Router()
 
@@ -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'
   }