aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/helpers/express-utils.ts6
-rw-r--r--server/tests/api/videos/index.ts2
-rw-r--r--server/tests/api/videos/video-nsfw.ts3
3 files changed, 9 insertions, 2 deletions
diff --git a/server/helpers/express-utils.ts b/server/helpers/express-utils.ts
index b715fb7d0..9cf8fbeac 100644
--- a/server/helpers/express-utils.ts
+++ b/server/helpers/express-utils.ts
@@ -14,8 +14,12 @@ function buildNSFWFilter (res: express.Response, paramNSFW?: string) {
14 14
15 if (res.locals.oauth) { 15 if (res.locals.oauth) {
16 const user: User = res.locals.oauth.token.User 16 const user: User = res.locals.oauth.token.User
17
17 // User does not want NSFW videos 18 // User does not want NSFW videos
18 if (user && user.nsfwPolicy === 'do_not_list') return false 19 if (user.nsfwPolicy === 'do_not_list') return false
20
21 // Both
22 return undefined
19 } 23 }
20 24
21 if (CONFIG.INSTANCE.DEFAULT_NSFW_POLICY === 'do_not_list') return false 25 if (CONFIG.INSTANCE.DEFAULT_NSFW_POLICY === 'do_not_list') return false
diff --git a/server/tests/api/videos/index.ts b/server/tests/api/videos/index.ts
index a328a49c1..bf58f9c79 100644
--- a/server/tests/api/videos/index.ts
+++ b/server/tests/api/videos/index.ts
@@ -5,7 +5,7 @@ import './video-abuse'
5import './video-blacklist' 5import './video-blacklist'
6import './video-blacklist-management' 6import './video-blacklist-management'
7import './video-captions' 7import './video-captions'
8import './vidoe-change-ownership' 8import './video-change-ownership'
9import './video-channels' 9import './video-channels'
10import './video-comments' 10import './video-comments'
11import './video-description' 11import './video-description'
diff --git a/server/tests/api/videos/video-nsfw.ts b/server/tests/api/videos/video-nsfw.ts
index 891148b07..eab7a6991 100644
--- a/server/tests/api/videos/video-nsfw.ts
+++ b/server/tests/api/videos/video-nsfw.ts
@@ -148,6 +148,9 @@ describe('Test video NSFW policy', function () {
148 }) 148 })
149 149
150 it('Should display NSFW videos with blur user NSFW policy', async function () { 150 it('Should display NSFW videos with blur user NSFW policy', async function () {
151 customConfig.instance.defaultNSFWPolicy = 'do_not_list'
152 await updateCustomConfig(server.url, server.accessToken, customConfig)
153
151 for (const res of await getVideosFunctions(userAccessToken)) { 154 for (const res of await getVideosFunctions(userAccessToken)) {
152 expect(res.body.total).to.equal(2) 155 expect(res.body.total).to.equal(2)
153 156