X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fvideos%2Fshared%2Fvideo-details.model.ts;h=84f96a25ffe6fa1e04cfc9f431b3e7523a22f0ae;hb=8e6964874990d5ee9d3703be71c6ab4617b9ce20;hp=e99a5ce2e53deb3b82097f612a347718b1ebc8cc;hpb=404b54e14f6623c1644a8c87ca22f4bab98d5484;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/videos/shared/video-details.model.ts b/client/src/app/videos/shared/video-details.model.ts index e99a5ce2e..84f96a25f 100644 --- a/client/src/app/videos/shared/video-details.model.ts +++ b/client/src/app/videos/shared/video-details.model.ts @@ -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 } }