X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-moderation%2Fblocklist.service.ts;h=3e92c2831fa8f0ba7dbe1e6caefbb9d63233807d;hb=a282e4d8a072cd56db8c393be7715bda420a243d;hp=f4836c6c4bd694893ea29cc66163ae8207f1b4cb;hpb=5a8de57d574045c5f819b8c81fb0530a9e9a699f;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/shared-moderation/blocklist.service.ts b/client/src/app/shared/shared-moderation/blocklist.service.ts index f4836c6c4..3e92c2831 100644 --- a/client/src/app/shared/shared-moderation/blocklist.service.ts +++ b/client/src/app/shared/shared-moderation/blocklist.service.ts @@ -1,5 +1,6 @@ import { SortMeta } from 'primeng/api' -import { catchError, map } from 'rxjs/operators' +import { from } from 'rxjs' +import { catchError, concatMap, map, toArray } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' import { RestExtractor, RestPagination, RestService } from '@app/core' @@ -120,11 +121,15 @@ export class BlocklistService { ) } - blockAccountByInstance (account: Pick) { - const body = { accountName: account.nameWithHost } + blockAccountByInstance (accountsArg: Pick | Pick[]) { + const accounts = Array.isArray(accountsArg) ? accountsArg : [ accountsArg ] - return this.authHttp.post(BlocklistService.BASE_SERVER_BLOCKLIST_URL + '/accounts', body) - .pipe(catchError(err => this.restExtractor.handleError(err))) + return from(accounts) + .pipe( + concatMap(a => this.authHttp.post(BlocklistService.BASE_SERVER_BLOCKLIST_URL + '/accounts', { accountName: a.nameWithHost })), + toArray(), + catchError(err => this.restExtractor.handleError(err)) + ) } unblockAccountByInstance (account: Pick) {