aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/video/video.model.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/video/video.model.ts')
-rw-r--r--client/src/app/shared/video/video.model.ts13
1 files changed, 10 insertions, 3 deletions
diff --git a/client/src/app/shared/video/video.model.ts b/client/src/app/shared/video/video.model.ts
index 0c02cbcb9..adc248a1e 100644
--- a/client/src/app/shared/video/video.model.ts
+++ b/client/src/app/shared/video/video.model.ts
@@ -4,6 +4,7 @@ import { Video as VideoServerModel } from '../../../../../shared'
4import { Avatar } from '../../../../../shared/models/avatars/avatar.model' 4import { Avatar } from '../../../../../shared/models/avatars/avatar.model'
5import { VideoConstant } from '../../../../../shared/models/videos/video.model' 5import { VideoConstant } from '../../../../../shared/models/videos/video.model'
6import { getAbsoluteAPIUrl } from '../misc/utils' 6import { getAbsoluteAPIUrl } from '../misc/utils'
7import { ServerConfig } from '../../../../../shared/models'
7 8
8export class Video implements VideoServerModel { 9export class Video implements VideoServerModel {
9 by: string 10 by: string
@@ -83,8 +84,14 @@ export class Video implements VideoServerModel {
83 this.by = Account.CREATE_BY_STRING(hash.account.name, hash.account.host) 84 this.by = Account.CREATE_BY_STRING(hash.account.name, hash.account.host)
84 } 85 }
85 86
86 isVideoNSFWForUser (user: User) { 87 isVideoNSFWForUser (user: User, serverConfig: ServerConfig) {
87 // If the video is NSFW and the user is not logged in, or the user does not want to display NSFW videos... 88 // Video is not NSFW, skip
88 return (this.nsfw && (!user || user.displayNSFW === false)) 89 if (this.nsfw === false) return false
90
91 // Return user setting if logged in
92 if (user) return user.nsfwPolicy !== 'display'
93
94 // Return default instance config
95 return serverConfig.instance.defaultNSFWPolicy !== 'display'
89 } 96 }
90} 97}