]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/video/video-details.model.ts
Translate subtitle langs in player
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / video / video-details.model.ts
index a1f7207a28149febeed5a569435dcf97da8a48a6..d346f985cbe2be5fa712e5c8912b2f5d0658fea2 100644 (file)
@@ -1,17 +1,16 @@
 import {
   UserRight,
   VideoChannel,
+  VideoConstant,
   VideoDetails as VideoDetailsServerModel,
   VideoFile,
-  VideoPrivacy
+  VideoState
 } from '../../../../../shared'
-import { Account } from '../../../../../shared/models/actors'
-import { VideoConstant } from '../../../../../shared/models/videos/video.model'
 import { AuthUser } from '../../core'
 import { Video } from '../../shared/video/video.model'
+import { Account } from '@app/shared/account/account.model'
 
 export class VideoDetails extends Video implements VideoDetailsServerModel {
-  privacy: VideoConstant<VideoPrivacy>
   descriptionPath: string
   support: string
   channel: VideoChannel
@@ -20,17 +19,19 @@ export class VideoDetails extends Video implements VideoDetailsServerModel {
   account: Account
   commentsEnabled: boolean
 
+  waitTranscoding: boolean
+  state: VideoConstant<VideoState>
+
   likesPercent: number
   dislikesPercent: number
 
-  constructor (hash: VideoDetailsServerModel) {
-    super(hash)
+  constructor (hash: VideoDetailsServerModel, translations = {}) {
+    super(hash, translations)
 
-    this.privacy = hash.privacy
     this.descriptionPath = hash.descriptionPath
     this.files = hash.files
     this.channel = hash.channel
-    this.account = hash.account
+    this.account = new Account(hash.account)
     this.tags = hash.tags
     this.support = hash.support
     this.commentsEnabled = hash.commentsEnabled
@@ -43,7 +44,11 @@ export class VideoDetails extends Video implements VideoDetailsServerModel {
   }
 
   isBlackistableBy (user: AuthUser) {
-    return user && user.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) === true && this.isLocal === false
+    return this.blacklisted !== true && user && user.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) === true
+  }
+
+  isUnblacklistableBy (user: AuthUser) {
+    return this.blacklisted === true && user && user.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) === true
   }
 
   isUpdatableBy (user: AuthUser) {