diff options
author | Chocobozzz <me@florianbigard.com> | 2021-11-17 11:18:49 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-11-17 11:18:49 +0100 |
commit | 3cfa817672657df18260ece5b354efa0f3b6e317 (patch) | |
tree | 318a7113fac4fcf1e6d0f7888cda1939aeefc500 /client/src/app/shared/shared-moderation/video-block.service.ts | |
parent | 4bdff96d77c03e5cce6052188f69a65bf6ea5781 (diff) | |
download | PeerTube-3cfa817672657df18260ece5b354efa0f3b6e317.tar.gz PeerTube-3cfa817672657df18260ece5b354efa0f3b6e317.tar.zst PeerTube-3cfa817672657df18260ece5b354efa0f3b6e317.zip |
Add ability to bulk block videos
Diffstat (limited to 'client/src/app/shared/shared-moderation/video-block.service.ts')
-rw-r--r-- | client/src/app/shared/shared-moderation/video-block.service.ts | 24 |
1 files changed, 14 insertions, 10 deletions
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 { | |||
63 | ) | 63 | ) |
64 | } | 64 | } |
65 | 65 | ||
66 | blockVideo (videoId: number, reason: string, unfederate: boolean) { | 66 | blockVideo (options: { |
67 | const body = { | 67 | videoId: number |
68 | unfederate, | 68 | reason?: string |
69 | reason | 69 | unfederate: boolean |
70 | } | 70 | }[]) { |
71 | return observableFrom(options) | ||
72 | .pipe( | ||
73 | concatMap(({ videoId, unfederate, reason }) => { | ||
74 | const body = { unfederate, reason } | ||
71 | 75 | ||
72 | return this.authHttp.post(VideoBlockService.BASE_VIDEOS_URL + videoId + '/blacklist', body) | 76 | return this.authHttp.post(VideoBlockService.BASE_VIDEOS_URL + videoId + '/blacklist', body) |
73 | .pipe( | 77 | }), |
74 | map(this.restExtractor.extractDataBool), | 78 | toArray(), |
75 | catchError(res => this.restExtractor.handleError(res)) | 79 | catchError(res => this.restExtractor.handleError(res)) |
76 | ) | 80 | ) |
77 | } | 81 | } |
78 | } | 82 | } |