aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-main
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/shared-main')
-rw-r--r--client/src/app/shared/shared-main/video/video.model.ts11
-rw-r--r--client/src/app/shared/shared-main/video/video.service.ts34
2 files changed, 26 insertions, 19 deletions
diff --git a/client/src/app/shared/shared-main/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.ts
index 10caec014..699eac7f1 100644
--- a/client/src/app/shared/shared-main/video/video.model.ts
+++ b/client/src/app/shared/shared-main/video/video.model.ts
@@ -65,8 +65,12 @@ export class Video implements VideoServerModel {
65 waitTranscoding?: boolean 65 waitTranscoding?: boolean
66 state?: VideoConstant<VideoState> 66 state?: VideoConstant<VideoState>
67 scheduledUpdate?: VideoScheduleUpdate 67 scheduledUpdate?: VideoScheduleUpdate
68
68 blacklisted?: boolean 69 blacklisted?: boolean
69 blockedReason?: string 70 blacklistedReason?: string
71
72 blockedOwner?: boolean
73 blockedServer?: boolean
70 74
71 account: { 75 account: {
72 id: number 76 id: number
@@ -163,7 +167,10 @@ export class Video implements VideoServerModel {
163 if (this.state) this.state.label = peertubeTranslate(this.state.label, translations) 167 if (this.state) this.state.label = peertubeTranslate(this.state.label, translations)
164 168
165 this.blacklisted = hash.blacklisted 169 this.blacklisted = hash.blacklisted
166 this.blockedReason = hash.blacklistedReason 170 this.blacklistedReason = hash.blacklistedReason
171
172 this.blockedOwner = hash.blockedOwner
173 this.blockedServer = hash.blockedServer
167 174
168 this.userHistory = hash.userHistory 175 this.userHistory = hash.userHistory
169 176
diff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.ts
index 9e3aa1e6a..0a3a51b0c 100644
--- a/client/src/app/shared/shared-main/video/video.service.ts
+++ b/client/src/app/shared/shared-main/video/video.service.ts
@@ -18,7 +18,7 @@ import {
18 VideoConstant, 18 VideoConstant,
19 VideoDetails as VideoDetailsServerModel, 19 VideoDetails as VideoDetailsServerModel,
20 VideoFileMetadata, 20 VideoFileMetadata,
21 VideoFilter, 21 VideoInclude,
22 VideoPrivacy, 22 VideoPrivacy,
23 VideoSortField, 23 VideoSortField,
24 VideoUpdate 24 VideoUpdate
@@ -34,11 +34,13 @@ import { Video } from './video.model'
34export type CommonVideoParams = { 34export type CommonVideoParams = {
35 videoPagination?: ComponentPaginationLight 35 videoPagination?: ComponentPaginationLight
36 sort: VideoSortField | SortMeta 36 sort: VideoSortField | SortMeta
37 filter?: VideoFilter 37 include?: VideoInclude
38 isLocal?: boolean
38 categoryOneOf?: number[] 39 categoryOneOf?: number[]
39 languageOneOf?: string[] 40 languageOneOf?: string[]
40 isLive?: boolean 41 isLive?: boolean
41 skipCount?: boolean 42 skipCount?: boolean
43
42 // FIXME: remove? 44 // FIXME: remove?
43 nsfwPolicy?: NSFWPolicyType 45 nsfwPolicy?: NSFWPolicyType
44 nsfw?: BooleanBothQuery 46 nsfw?: BooleanBothQuery
@@ -202,12 +204,14 @@ export class VideoService {
202 } 204 }
203 205
204 getAdminVideos ( 206 getAdminVideos (
205 parameters: Omit<CommonVideoParams, 'filter'> & { pagination: RestPagination, search?: string } 207 parameters: CommonVideoParams & { pagination: RestPagination, search?: string }
206 ): Observable<ResultList<Video>> { 208 ): Observable<ResultList<Video>> {
207 const { pagination, search } = parameters 209 const { pagination, search } = parameters
208 210
211 const include = VideoInclude.BLACKLISTED | VideoInclude.BLOCKED_OWNER | VideoInclude.HIDDEN_PRIVACY | VideoInclude.NOT_PUBLISHED_STATE
212
209 let params = new HttpParams() 213 let params = new HttpParams()
210 params = this.buildCommonVideosParams({ params, ...parameters }) 214 params = this.buildCommonVideosParams({ params, include, ...parameters })
211 215
212 params = params.set('start', pagination.start.toString()) 216 params = params.set('start', pagination.start.toString())
213 .set('count', pagination.count.toString()) 217 .set('count', pagination.count.toString())
@@ -216,8 +220,6 @@ export class VideoService {
216 params = this.buildAdminParamsFromSearch(search, params) 220 params = this.buildAdminParamsFromSearch(search, params)
217 } 221 }
218 222
219 if (!params.has('filter')) params = params.set('filter', 'all')
220
221 return this.authHttp 223 return this.authHttp
222 .get<ResultList<Video>>(VideoService.BASE_VIDEO_URL, { params }) 224 .get<ResultList<Video>>(VideoService.BASE_VIDEO_URL, { params })
223 .pipe( 225 .pipe(
@@ -266,10 +268,10 @@ export class VideoService {
266 return feeds 268 return feeds
267 } 269 }
268 270
269 getVideoFeedUrls (sort: VideoSortField, filter?: VideoFilter, categoryOneOf?: number[]) { 271 getVideoFeedUrls (sort: VideoSortField, isLocal: boolean, categoryOneOf?: number[]) {
270 let params = this.restService.addRestGetParams(new HttpParams(), undefined, sort) 272 let params = this.restService.addRestGetParams(new HttpParams(), undefined, sort)
271 273
272 if (filter) params = params.set('filter', filter) 274 if (isLocal) params = params.set('isLocal', isLocal)
273 275
274 if (categoryOneOf) { 276 if (categoryOneOf) {
275 for (const c of categoryOneOf) { 277 for (const c of categoryOneOf) {
@@ -425,7 +427,8 @@ export class VideoService {
425 params, 427 params,
426 videoPagination, 428 videoPagination,
427 sort, 429 sort,
428 filter, 430 isLocal,
431 include,
429 categoryOneOf, 432 categoryOneOf,
430 languageOneOf, 433 languageOneOf,
431 skipCount, 434 skipCount,
@@ -440,9 +443,10 @@ export class VideoService {
440 443
441 let newParams = this.restService.addRestGetParams(params, pagination, sort) 444 let newParams = this.restService.addRestGetParams(params, pagination, sort)
442 445
443 if (filter) newParams = newParams.set('filter', filter)
444 if (skipCount) newParams = newParams.set('skipCount', skipCount + '') 446 if (skipCount) newParams = newParams.set('skipCount', skipCount + '')
445 447
448 if (isLocal) newParams = newParams.set('isLocal', isLocal)
449 if (include) newParams = newParams.set('include', include)
446 if (isLive) newParams = newParams.set('isLive', isLive) 450 if (isLive) newParams = newParams.set('isLive', isLive)
447 if (nsfw) newParams = newParams.set('nsfw', nsfw) 451 if (nsfw) newParams = newParams.set('nsfw', nsfw)
448 if (nsfwPolicy) newParams = newParams.set('nsfw', this.nsfwPolicyToParam(nsfwPolicy)) 452 if (nsfwPolicy) newParams = newParams.set('nsfw', this.nsfwPolicyToParam(nsfwPolicy))
@@ -454,13 +458,9 @@ export class VideoService {
454 458
455 private buildAdminParamsFromSearch (search: string, params: HttpParams) { 459 private buildAdminParamsFromSearch (search: string, params: HttpParams) {
456 const filters = this.restService.parseQueryStringFilter(search, { 460 const filters = this.restService.parseQueryStringFilter(search, {
457 filter: { 461 isLocal: {
458 prefix: 'local:', 462 prefix: 'isLocal:',
459 handler: v => { 463 isBoolean: true
460 if (v === 'true') return 'all-local'
461
462 return 'all'
463 }
464 } 464 }
465 }) 465 })
466 466