]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-moderation/video-block.service.ts
Fix services tests
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-moderation / video-block.service.ts
index c22ceefcce4d6d5a16a75ba89c3636c2e62a9d81..5dfb0d7d451d3574ab8bb034a877b176aadb8d8a 100644 (file)
@@ -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))
+      )
   }
 }