1
0
Fork 0

Fix videos list user NSFW policy

This commit is contained in:
Chocobozzz 2018-09-21 14:08:14 +02:00
parent 6937f26a5e
commit d1a63fc7ac
No known key found for this signature in database
GPG key ID: 583A612D890159BE
3 changed files with 7 additions and 6 deletions

View 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 () {

View 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: {

View 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