X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-video-comment%2Fvideo-comment.service.ts;h=c107a33abb5937bb9ee500b108175a2e503cd4f4;hb=939917705fa3fa93ab7036b5e7e9aaf5f1d0023e;hp=e318e069d0016a2eac13bba1919dadd883e560fb;hpb=0f8d00e3144060270d7fe603865fccaf18649c47;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/shared-video-comment/video-comment.service.ts b/client/src/app/shared/shared-video-comment/video-comment.service.ts index e318e069d..c107a33ab 100644 --- a/client/src/app/shared/shared-video-comment/video-comment.service.ts +++ b/client/src/app/shared/shared-video-comment/video-comment.service.ts @@ -1,5 +1,6 @@ -import { Observable } from 'rxjs' -import { catchError, map } from 'rxjs/operators' +import { SortMeta } from 'primeng/api' +import { from, Observable } from 'rxjs' +import { catchError, concatMap, map, toArray } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' import { ComponentPaginationLight, RestExtractor, RestPagination, RestService } from '@app/core' @@ -15,12 +16,12 @@ import { import { environment } from '../../../environments/environment' import { VideoCommentThreadTree } from './video-comment-thread-tree.model' import { VideoComment } from './video-comment.model' -import { SortMeta } from 'primeng/api' @Injectable() export class VideoCommentService { + static BASE_FEEDS_URL = environment.apiUrl + '/feeds/video-comments.' + private static BASE_VIDEO_URL = environment.apiUrl + '/api/v1/videos/' - private static BASE_FEEDS_URL = environment.apiUrl + '/feeds/video-comments.' constructor ( private authHttp: HttpClient, @@ -56,7 +57,7 @@ export class VideoCommentService { search?: string }): Observable> { const { pagination, sort, search } = options - const url = VideoCommentService.BASE_VIDEO_URL + '/comments' + const url = VideoCommentService.BASE_VIDEO_URL + 'comments' let params = new HttpParams() params = this.restService.addRestGetParams(params, pagination, sort) @@ -117,6 +118,14 @@ export class VideoCommentService { ) } + deleteVideoComments (comments: { videoId: number | string, commentId: number }[]) { + return from(comments) + .pipe( + concatMap(c => this.deleteVideoComment(c.videoId, c.commentId)), + toArray() + ) + } + getVideoCommentsFeeds (videoUUID?: string) { const feeds = [ { @@ -172,7 +181,7 @@ export class VideoCommentService { private buildParamsFromSearch (search: string, params: HttpParams) { const filters = this.restService.parseQueryStringFilter(search, { - state: { + isLocal: { prefix: 'local:', isBoolean: true, handler: v => {