aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-09-21 14:08:14 +0200
committerChocobozzz <me@florianbigard.com>2018-09-24 13:38:38 +0200
commitd1a63fc7ac58a1db00d8ca4f43aadba02eb9b084 (patch)
treebe1c7f15a3403d59749571dcd1206bdc8dab94c6
parent6937f26a5e8b17c7a27f267bce2682ab01611f2f (diff)
downloadPeerTube-d1a63fc7ac58a1db00d8ca4f43aadba02eb9b084.tar.gz
PeerTube-d1a63fc7ac58a1db00d8ca4f43aadba02eb9b084.tar.zst
PeerTube-d1a63fc7ac58a1db00d8ca4f43aadba02eb9b084.zip
Fix videos list user NSFW policy
-rw-r--r--client/src/app/shared/video/video-miniature.component.ts8
-rw-r--r--client/webpack/webpack.video-embed.js2
-rw-r--r--server/helpers/express-utils.ts3
3 files changed, 7 insertions, 6 deletions
diff --git a/client/src/app/shared/video/video-miniature.component.ts b/client/src/app/shared/video/video-miniature.component.ts
index 27098f4b4..7e8692b0b 100644
--- a/client/src/app/shared/video/video-miniature.component.ts
+++ b/client/src/app/shared/video/video-miniature.component.ts
@@ -16,12 +16,14 @@ export class VideoMiniatureComponent implements OnInit {
16 @Input() video: Video 16 @Input() video: Video
17 @Input() ownerDisplayType: OwnerDisplayType = 'account' 17 @Input() ownerDisplayType: OwnerDisplayType = 'account'
18 18
19 isVideoBlur: boolean
20
21 private ownerDisplayTypeChosen: 'account' | 'videoChannel' 19 private ownerDisplayTypeChosen: 'account' | 'videoChannel'
22 20
23 constructor (private serverService: ServerService) { } 21 constructor (private serverService: ServerService) { }
24 22
23 get isVideoBlur () {
24 return this.video.isVideoNSFWForUser(this.user, this.serverService.getConfig())
25 }
26
25 ngOnInit () { 27 ngOnInit () {
26 if (this.ownerDisplayType === 'account' || this.ownerDisplayType === 'videoChannel') { 28 if (this.ownerDisplayType === 'account' || this.ownerDisplayType === 'videoChannel') {
27 this.ownerDisplayTypeChosen = this.ownerDisplayType 29 this.ownerDisplayTypeChosen = this.ownerDisplayType
@@ -38,8 +40,6 @@ export class VideoMiniatureComponent implements OnInit {
38 } else { 40 } else {
39 this.ownerDisplayTypeChosen = 'videoChannel' 41 this.ownerDisplayTypeChosen = 'videoChannel'
40 } 42 }
41
42 this.isVideoBlur = this.video.isVideoNSFWForUser(this.user, this.serverService.getConfig())
43 } 43 }
44 44
45 displayOwnerAccount () { 45 displayOwnerAccount () {
diff --git a/client/webpack/webpack.video-embed.js b/client/webpack/webpack.video-embed.js
index 12ab6a639..909048cca 100644
--- a/client/webpack/webpack.video-embed.js
+++ b/client/webpack/webpack.video-embed.js
@@ -39,7 +39,7 @@ module.exports = function () {
39 publicPath: '/client/standalone/videos/' 39 publicPath: '/client/standalone/videos/'
40 }, 40 },
41 41
42 // devtool: 'source-map', 42 devtool: process.env.NODE_ENV === 'production' ? false : 'source-map',
43 43
44 module: { 44 module: {
45 45
diff --git a/server/helpers/express-utils.ts b/server/helpers/express-utils.ts
index 9cf8fbeac..8a9cee8c5 100644
--- a/server/helpers/express-utils.ts
+++ b/server/helpers/express-utils.ts
@@ -6,6 +6,7 @@ import { User } from '../../shared/models/users'
6import { deleteFileAsync, generateRandomString } from './utils' 6import { deleteFileAsync, generateRandomString } from './utils'
7import { extname } from 'path' 7import { extname } from 'path'
8import { isArray } from './custom-validators/misc' 8import { isArray } from './custom-validators/misc'
9import { UserModel } from '../models/account/user'
9 10
10function buildNSFWFilter (res: express.Response, paramNSFW?: string) { 11function buildNSFWFilter (res: express.Response, paramNSFW?: string) {
11 if (paramNSFW === 'true') return true 12 if (paramNSFW === 'true') return true
@@ -13,7 +14,7 @@ function buildNSFWFilter (res: express.Response, paramNSFW?: string) {
13 if (paramNSFW === 'both') return undefined 14 if (paramNSFW === 'both') return undefined
14 15
15 if (res.locals.oauth) { 16 if (res.locals.oauth) {
16 const user: User = res.locals.oauth.token.User 17 const user: UserModel = res.locals.oauth.token.User
17 18
18 // User does not want NSFW videos 19 // User does not want NSFW videos
19 if (user.nsfwPolicy === 'do_not_list') return false 20 if (user.nsfwPolicy === 'do_not_list') return false