]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/videos/shared/video-details.model.ts
Add MANAGE_PEERTUBE_FOLLOW right
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / shared / video-details.model.ts
index e99a5ce2e53deb3b82097f612a347718b1ebc8cc..84f96a25ffe6fa1e04cfc9f431b3e7523a22f0ae 100644 (file)
@@ -1,9 +1,12 @@
 import { Video } from './video.model'
+import { AuthUser } from '../../core'
 import {
   VideoDetails as VideoDetailsServerModel,
   VideoFile,
   VideoChannel,
-  VideoResolution
+  VideoResolution,
+  UserRight,
+  VideoPrivacy
 } from '../../../../../shared'
 
 export class VideoDetails extends Video implements VideoDetailsServerModel {
@@ -36,12 +39,18 @@ export class VideoDetails extends Video implements VideoDetailsServerModel {
   likes: number
   dislikes: number
   nsfw: boolean
+  descriptionPath: string
   files: VideoFile[]
   channel: VideoChannel
+  privacy: VideoPrivacy
+  privacyLabel: string
 
   constructor (hash: VideoDetailsServerModel) {
     super(hash)
 
+    this.privacy = hash.privacy
+    this.privacyLabel = hash.privacyLabel
+    this.descriptionPath = hash.descriptionPath
     this.files = hash.files
     this.channel = hash.channel
   }
@@ -61,15 +70,15 @@ export class VideoDetails extends Video implements VideoDetailsServerModel {
     return betterResolutionFile.magnetUri
   }
 
-  isRemovableBy (user) {
-    return user && this.isLocal === true && (this.author === user.username || user.isAdmin() === true)
+  isRemovableBy (user: AuthUser) {
+    return user && this.isLocal === true && (this.author === user.username || user.hasRight(UserRight.REMOVE_ANY_VIDEO))
   }
 
-  isBlackistableBy (user) {
-    return user && user.isAdmin() === true && this.isLocal === false
+  isBlackistableBy (user: AuthUser) {
+    return user && user.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) === true && this.isLocal === false
   }
 
-  isUpdatableBy (user) {
+  isUpdatableBy (user: AuthUser) {
     return user && this.isLocal === true && user.username === this.author
   }
 }