+ this.account = hash.account
+ this.channel = hash.channel
+
+ this.byAccount = Actor.CREATE_BY_STRING(hash.account.name, hash.account.host)
+ this.byVideoChannel = Actor.CREATE_BY_STRING(hash.channel.name, hash.channel.host)
+ this.accountAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.account)
+ this.videoChannelAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.channel)
+
+ this.category.label = peertubeTranslate(this.category.label, translations)
+ this.licence.label = peertubeTranslate(this.licence.label, translations)
+ this.language.label = peertubeTranslate(this.language.label, translations)
+ this.privacy.label = peertubeTranslate(this.privacy.label, translations)
+
+ this.scheduledUpdate = hash.scheduledUpdate
+ this.originallyPublishedAt = hash.originallyPublishedAt ? new Date(hash.originallyPublishedAt.toString()) : null
+
+ if (this.state) this.state.label = peertubeTranslate(this.state.label, translations)
+
+ this.blacklisted = hash.blacklisted
+ this.blacklistedReason = hash.blacklistedReason
+
+ this.userHistory = hash.userHistory
+ }
+
+ isVideoNSFWForUser (user: User, serverConfig: ServerConfig) {
+ // Video is not NSFW, skip
+ if (this.nsfw === false) return false
+
+ // Return user setting if logged in
+ if (user) return user.nsfwPolicy !== 'display'
+
+ // Return default instance config
+ return serverConfig.instance.defaultNSFWPolicy !== 'display'
+ }
+
+ isRemovableBy (user: AuthUser) {
+ return user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.REMOVE_ANY_VIDEO))
+ }
+
+ isBlackistableBy (user: AuthUser) {
+ return this.blacklisted !== true && user && user.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) === true
+ }