From 3cfa817672657df18260ece5b354efa0f3b6e317 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 17 Nov 2021 11:18:49 +0100 Subject: Add ability to bulk block videos --- .../shared-moderation/video-block.service.ts | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'client/src/app/shared/shared-moderation/video-block.service.ts') diff --git a/client/src/app/shared/shared-moderation/video-block.service.ts b/client/src/app/shared/shared-moderation/video-block.service.ts index c22ceefcc..5dfb0d7d4 100644 --- a/client/src/app/shared/shared-moderation/video-block.service.ts +++ b/client/src/app/shared/shared-moderation/video-block.service.ts @@ -63,16 +63,20 @@ export class VideoBlockService { ) } - blockVideo (videoId: number, reason: string, unfederate: boolean) { - const body = { - unfederate, - reason - } + blockVideo (options: { + videoId: number + reason?: string + unfederate: boolean + }[]) { + return observableFrom(options) + .pipe( + concatMap(({ videoId, unfederate, reason }) => { + const body = { unfederate, reason } - return this.authHttp.post(VideoBlockService.BASE_VIDEOS_URL + videoId + '/blacklist', body) - .pipe( - map(this.restExtractor.extractDataBool), - catchError(res => this.restExtractor.handleError(res)) - ) + return this.authHttp.post(VideoBlockService.BASE_VIDEOS_URL + videoId + '/blacklist', body) + }), + toArray(), + catchError(res => this.restExtractor.handleError(res)) + ) } } -- cgit v1.2.3