Browse Source

Fix videos list user NSFW policy

Chocobozzz 1 year ago
parent
commit
d1a63fc7ac
No account linked to committer's email address

+ 4
- 4
client/src/app/shared/video/video-miniature.component.ts View File

@@ -16,12 +16,14 @@ export class VideoMiniatureComponent implements OnInit {
16 16
   @Input() video: Video
17 17
   @Input() ownerDisplayType: OwnerDisplayType = 'account'
18 18
 
19
-  isVideoBlur: boolean
20
-
21 19
   private ownerDisplayTypeChosen: 'account' | 'videoChannel'
22 20
 
23 21
   constructor (private serverService: ServerService) { }
24 22
 
23
+  get isVideoBlur () {
24
+    return this.video.isVideoNSFWForUser(this.user, this.serverService.getConfig())
25
+  }
26
+
25 27
   ngOnInit () {
26 28
     if (this.ownerDisplayType === 'account' || this.ownerDisplayType === 'videoChannel') {
27 29
       this.ownerDisplayTypeChosen = this.ownerDisplayType
@@ -38,8 +40,6 @@ export class VideoMiniatureComponent implements OnInit {
38 40
     } else {
39 41
       this.ownerDisplayTypeChosen = 'videoChannel'
40 42
     }
41
-
42
-    this.isVideoBlur = this.video.isVideoNSFWForUser(this.user, this.serverService.getConfig())
43 43
   }
44 44
 
45 45
   displayOwnerAccount () {

+ 1
- 1
client/webpack/webpack.video-embed.js View File

@@ -39,7 +39,7 @@ module.exports = function () {
39 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 44
     module: {
45 45
 

+ 2
- 1
server/helpers/express-utils.ts View File

@@ -6,6 +6,7 @@ import { User } from '../../shared/models/users'
6 6
 import { deleteFileAsync, generateRandomString } from './utils'
7 7
 import { extname } from 'path'
8 8
 import { isArray } from './custom-validators/misc'
9
+import { UserModel } from '../models/account/user'
9 10
 
10 11
 function buildNSFWFilter (res: express.Response, paramNSFW?: string) {
11 12
   if (paramNSFW === 'true') return true
@@ -13,7 +14,7 @@ function buildNSFWFilter (res: express.Response, paramNSFW?: string) {
13 14
   if (paramNSFW === 'both') return undefined
14 15
 
15 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 19
     // User does not want NSFW videos
19 20
     if (user.nsfwPolicy === 'do_not_list') return false

Loading…
Cancel
Save