-import { Video } from '../../shared/video/video.model'
-import { AuthUser } from '../../core'
import {
- VideoDetails as VideoDetailsServerModel,
- VideoFile,
- VideoChannel,
- VideoResolution,
- UserRight,
- VideoPrivacy
+ UserRight, VideoChannel, VideoDetails as VideoDetailsServerModel, VideoFile, VideoPrivacy,
+ VideoResolution
} from '../../../../../shared'
+import { Account } from '../../../../../shared/models/actors'
+import { AuthUser } from '../../core'
+import { Video } from '../../shared/video/video.model'
export class VideoDetails extends Video implements VideoDetailsServerModel {
- account: string
+ accountName: string
by: string
createdAt: Date
updatedAt: Date
channel: VideoChannel
privacy: VideoPrivacy
privacyLabel: string
+ account: Account
+ likesPercent: number
+ dislikesPercent: number
+ commentsEnabled: boolean
constructor (hash: VideoDetailsServerModel) {
super(hash)
this.descriptionPath = hash.descriptionPath
this.files = hash.files
this.channel = hash.channel
+ this.account = hash.account
+ this.tags = hash.tags
+ this.commentsEnabled = hash.commentsEnabled
+
+ this.likesPercent = (this.likes / (this.likes + this.dislikes)) * 100
+ this.dislikesPercent = (this.dislikes / (this.likes + this.dislikes)) * 100
}
getAppropriateMagnetUri (actualDownloadSpeed = 0) {
}
isRemovableBy (user: AuthUser) {
- return user && this.isLocal === true && (this.account === user.username || user.hasRight(UserRight.REMOVE_ANY_VIDEO))
+ return user && this.isLocal === true && (this.accountName === user.username || user.hasRight(UserRight.REMOVE_ANY_VIDEO))
}
isBlackistableBy (user: AuthUser) {
}
isUpdatableBy (user: AuthUser) {
- return user && this.isLocal === true && user.username === this.account
+ return user && this.isLocal === true && user.username === this.accountName
}
}