aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/video-blacklist/video-blacklist.service.ts6
-rw-r--r--client/src/app/shared/video/video-details.model.ts6
-rw-r--r--client/src/app/shared/video/video.model.ts9
3 files changed, 17 insertions, 4 deletions
diff --git a/client/src/app/shared/video-blacklist/video-blacklist.service.ts b/client/src/app/shared/video-blacklist/video-blacklist.service.ts
index a014260b1..7d39fd4f2 100644
--- a/client/src/app/shared/video-blacklist/video-blacklist.service.ts
+++ b/client/src/app/shared/video-blacklist/video-blacklist.service.ts
@@ -3,7 +3,7 @@ import { HttpClient, HttpParams } from '@angular/common/http'
3import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
4import { SortMeta } from 'primeng/components/common/sortmeta' 4import { SortMeta } from 'primeng/components/common/sortmeta'
5import { Observable } from 'rxjs' 5import { Observable } from 'rxjs'
6import { BlacklistedVideo, ResultList } from '../../../../../shared' 6import { VideoBlacklist, ResultList } from '../../../../../shared'
7import { environment } from '../../../environments/environment' 7import { environment } from '../../../environments/environment'
8import { RestExtractor, RestPagination, RestService } from '../rest' 8import { RestExtractor, RestPagination, RestService } from '../rest'
9 9
@@ -17,11 +17,11 @@ export class VideoBlacklistService {
17 private restExtractor: RestExtractor 17 private restExtractor: RestExtractor
18 ) {} 18 ) {}
19 19
20 listBlacklist (pagination: RestPagination, sort: SortMeta): Observable<ResultList<BlacklistedVideo>> { 20 listBlacklist (pagination: RestPagination, sort: SortMeta): Observable<ResultList<VideoBlacklist>> {
21 let params = new HttpParams() 21 let params = new HttpParams()
22 params = this.restService.addRestGetParams(params, pagination, sort) 22 params = this.restService.addRestGetParams(params, pagination, sort)
23 23
24 return this.authHttp.get<ResultList<BlacklistedVideo>>(VideoBlacklistService.BASE_VIDEOS_URL + 'blacklist', { params }) 24 return this.authHttp.get<ResultList<VideoBlacklist>>(VideoBlacklistService.BASE_VIDEOS_URL + 'blacklist', { params })
25 .pipe( 25 .pipe(
26 map(res => this.restExtractor.convertResultListDateToHuman(res)), 26 map(res => this.restExtractor.convertResultListDateToHuman(res)),
27 catchError(res => this.restExtractor.handleError(res)) 27 catchError(res => this.restExtractor.handleError(res))
diff --git a/client/src/app/shared/video/video-details.model.ts b/client/src/app/shared/video/video-details.model.ts
index bdcc0bbba..d346f985c 100644
--- a/client/src/app/shared/video/video-details.model.ts
+++ b/client/src/app/shared/video/video-details.model.ts
@@ -44,7 +44,11 @@ export class VideoDetails extends Video implements VideoDetailsServerModel {
44 } 44 }
45 45
46 isBlackistableBy (user: AuthUser) { 46 isBlackistableBy (user: AuthUser) {
47 return user && user.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) === true 47 return this.blacklisted !== true && user && user.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) === true
48 }
49
50 isUnblacklistableBy (user: AuthUser) {
51 return this.blacklisted === true && user && user.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) === true
48 } 52 }
49 53
50 isUpdatableBy (user: AuthUser) { 54 isUpdatableBy (user: AuthUser) {
diff --git a/client/src/app/shared/video/video.model.ts b/client/src/app/shared/video/video.model.ts
index 6b1a299ea..ec0afcccb 100644
--- a/client/src/app/shared/video/video.model.ts
+++ b/client/src/app/shared/video/video.model.ts
@@ -41,6 +41,8 @@ export class Video implements VideoServerModel {
41 waitTranscoding?: boolean 41 waitTranscoding?: boolean
42 state?: VideoConstant<VideoState> 42 state?: VideoConstant<VideoState>
43 scheduledUpdate?: VideoScheduleUpdate 43 scheduledUpdate?: VideoScheduleUpdate
44 blacklisted?: boolean
45 blacklistedReason?: string
44 46
45 account: { 47 account: {
46 id: number 48 id: number
@@ -62,6 +64,10 @@ export class Video implements VideoServerModel {
62 avatar: Avatar 64 avatar: Avatar
63 } 65 }
64 66
67 static buildClientUrl (videoUUID: string) {
68 return '/videos/watch/' + videoUUID
69 }
70
65 private static createDurationString (duration: number) { 71 private static createDurationString (duration: number) {
66 const hours = Math.floor(duration / 3600) 72 const hours = Math.floor(duration / 3600)
67 const minutes = Math.floor((duration % 3600) / 60) 73 const minutes = Math.floor((duration % 3600) / 60)
@@ -116,6 +122,9 @@ export class Video implements VideoServerModel {
116 122
117 this.scheduledUpdate = hash.scheduledUpdate 123 this.scheduledUpdate = hash.scheduledUpdate
118 if (this.state) this.state.label = peertubeTranslate(this.state.label, translations) 124 if (this.state) this.state.label = peertubeTranslate(this.state.label, translations)
125
126 this.blacklisted = hash.blacklisted
127 this.blacklistedReason = hash.blacklistedReason
119 } 128 }
120 129
121 isVideoNSFWForUser (user: User, serverConfig: ServerConfig) { 130 isVideoNSFWForUser (user: User, serverConfig: ServerConfig) {