diff options
Diffstat (limited to 'client/src/app/shared/video/video.model.ts')
-rw-r--r-- | client/src/app/shared/video/video.model.ts | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/client/src/app/shared/video/video.model.ts b/client/src/app/shared/video/video.model.ts index 95b5e3671..0cef3eb8f 100644 --- a/client/src/app/shared/video/video.model.ts +++ b/client/src/app/shared/video/video.model.ts | |||
@@ -1,11 +1,12 @@ | |||
1 | import { User } from '../' | 1 | import { User } from '../' |
2 | import { PlaylistElement, Video as VideoServerModel, VideoPrivacy, VideoState } from '../../../../../shared' | 2 | import { PlaylistElement, UserRight, Video as VideoServerModel, VideoPrivacy, VideoState } from '../../../../../shared' |
3 | import { Avatar } from '../../../../../shared/models/avatars/avatar.model' | 3 | import { Avatar } from '../../../../../shared/models/avatars/avatar.model' |
4 | import { VideoConstant } from '../../../../../shared/models/videos/video-constant.model' | 4 | import { VideoConstant } from '../../../../../shared/models/videos/video-constant.model' |
5 | import { durationToString, getAbsoluteAPIUrl } from '../misc/utils' | 5 | import { durationToString, getAbsoluteAPIUrl } from '../misc/utils' |
6 | import { peertubeTranslate, ServerConfig } from '../../../../../shared/models' | 6 | import { peertubeTranslate, ServerConfig } from '../../../../../shared/models' |
7 | import { Actor } from '@app/shared/actor/actor.model' | 7 | import { Actor } from '@app/shared/actor/actor.model' |
8 | import { VideoScheduleUpdate } from '../../../../../shared/models/videos/video-schedule-update.model' | 8 | import { VideoScheduleUpdate } from '../../../../../shared/models/videos/video-schedule-update.model' |
9 | import { AuthUser } from '@app/core' | ||
9 | 10 | ||
10 | export class Video implements VideoServerModel { | 11 | export class Video implements VideoServerModel { |
11 | byVideoChannel: string | 12 | byVideoChannel: string |
@@ -141,4 +142,20 @@ export class Video implements VideoServerModel { | |||
141 | // Return default instance config | 142 | // Return default instance config |
142 | return serverConfig.instance.defaultNSFWPolicy !== 'display' | 143 | return serverConfig.instance.defaultNSFWPolicy !== 'display' |
143 | } | 144 | } |
145 | |||
146 | isRemovableBy (user: AuthUser) { | ||
147 | return user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.REMOVE_ANY_VIDEO)) | ||
148 | } | ||
149 | |||
150 | isBlackistableBy (user: AuthUser) { | ||
151 | return this.blacklisted !== true && user && user.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) === true | ||
152 | } | ||
153 | |||
154 | isUnblacklistableBy (user: AuthUser) { | ||
155 | return this.blacklisted === true && user && user.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) === true | ||
156 | } | ||
157 | |||
158 | isUpdatableBy (user: AuthUser) { | ||
159 | return user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.UPDATE_ANY_VIDEO)) | ||
160 | } | ||
144 | } | 161 | } |