]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix videos list user NSFW policy
authorChocobozzz <me@florianbigard.com>
Fri, 21 Sep 2018 12:08:14 +0000 (14:08 +0200)
committerChocobozzz <me@florianbigard.com>
Mon, 24 Sep 2018 11:38:38 +0000 (13:38 +0200)
client/src/app/shared/video/video-miniature.component.ts
client/webpack/webpack.video-embed.js
server/helpers/express-utils.ts

index 27098f4b4a0c097c5987572328d7b8dab1e5d7bb..7e8692b0be9f93b4bcb819ba431998e8a822cede 100644 (file)
@@ -16,12 +16,14 @@ export class VideoMiniatureComponent implements OnInit {
   @Input() video: Video
   @Input() ownerDisplayType: OwnerDisplayType = 'account'
 
-  isVideoBlur: boolean
-
   private ownerDisplayTypeChosen: 'account' | 'videoChannel'
 
   constructor (private serverService: ServerService) { }
 
+  get isVideoBlur () {
+    return this.video.isVideoNSFWForUser(this.user, this.serverService.getConfig())
+  }
+
   ngOnInit () {
     if (this.ownerDisplayType === 'account' || this.ownerDisplayType === 'videoChannel') {
       this.ownerDisplayTypeChosen = this.ownerDisplayType
@@ -38,8 +40,6 @@ export class VideoMiniatureComponent implements OnInit {
     } else {
       this.ownerDisplayTypeChosen = 'videoChannel'
     }
-
-    this.isVideoBlur = this.video.isVideoNSFWForUser(this.user, this.serverService.getConfig())
   }
 
   displayOwnerAccount () {
index 12ab6a639c40a93df09af7ef79f6e06c0da2098a..909048cca866a318508db4f7a27b6e3b76d6e35f 100644 (file)
@@ -39,7 +39,7 @@ module.exports = function () {
       publicPath: '/client/standalone/videos/'
     },
 
-    // devtool: 'source-map',
+    devtool: process.env.NODE_ENV === 'production' ? false : 'source-map',
 
     module: {
 
index 9cf8fbeac23fd608fd6644ade77533ee577c727b..8a9cee8c57a72756f857f44d14bb6cd3edc7c0c7 100644 (file)
@@ -6,6 +6,7 @@ import { User } from '../../shared/models/users'
 import { deleteFileAsync, generateRandomString } from './utils'
 import { extname } from 'path'
 import { isArray } from './custom-validators/misc'
+import { UserModel } from '../models/account/user'
 
 function buildNSFWFilter (res: express.Response, paramNSFW?: string) {
   if (paramNSFW === 'true') return true
@@ -13,7 +14,7 @@ function buildNSFWFilter (res: express.Response, paramNSFW?: string) {
   if (paramNSFW === 'both') return undefined
 
   if (res.locals.oauth) {
-    const user: User = res.locals.oauth.token.User
+    const user: UserModel = res.locals.oauth.token.User
 
     // User does not want NSFW videos
     if (user.nsfwPolicy === 'do_not_list') return false