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 {
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
}
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
}
}