aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-search
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/shared-search')
-rw-r--r--client/src/app/shared/shared-search/find-in-bulk.service.ts11
1 files changed, 6 insertions, 5 deletions
diff --git a/client/src/app/shared/shared-search/find-in-bulk.service.ts b/client/src/app/shared/shared-search/find-in-bulk.service.ts
index 6d77941d3..30cddc154 100644
--- a/client/src/app/shared/shared-search/find-in-bulk.service.ts
+++ b/client/src/app/shared/shared-search/find-in-bulk.service.ts
@@ -1,6 +1,6 @@
1import * as debug from 'debug' 1import * as debug from 'debug'
2import { Observable, Subject } from 'rxjs' 2import { Observable, Subject } from 'rxjs'
3import { first, map } from 'rxjs/operators' 3import { filter, first, map } from 'rxjs/operators'
4import { Injectable } from '@angular/core' 4import { Injectable } from '@angular/core'
5import { buildBulkObservable } from '@app/helpers' 5import { buildBulkObservable } from '@app/helpers'
6import { ResultList } from '@shared/models/common' 6import { ResultList } from '@shared/models/common'
@@ -12,7 +12,7 @@ const logger = debug('peertube:search:FindInBulkService')
12 12
13type BulkObservables <P extends number | string, R> = { 13type BulkObservables <P extends number | string, R> = {
14 notifier: Subject<P> 14 notifier: Subject<P>
15 result: Observable<R> 15 result: Observable<{ params: P[], response: R }>
16} 16}
17 17
18@Injectable() 18@Injectable()
@@ -70,8 +70,9 @@ export class FindInBulkService {
70 return new Observable<R>(obs => { 70 return new Observable<R>(obs => {
71 observableObject.result 71 observableObject.result
72 .pipe( 72 .pipe(
73 filter(result => result.params.includes(param)),
73 first(), 74 first(),
74 map(({ data }) => data), 75 map(result => result.response.data),
75 map(data => data.find(finder)) 76 map(data => data.find(finder))
76 ) 77 )
77 .subscribe(result => { 78 .subscribe(result => {
@@ -105,8 +106,8 @@ export class FindInBulkService {
105 return this.searchService.searchVideoPlaylists({ uuids }) 106 return this.searchService.searchVideoPlaylists({ uuids })
106 } 107 }
107 108
108 private buildBulkObservableObject <T extends number | string, R> (bulkGet: (params: T[]) => Observable<R>) { 109 private buildBulkObservableObject <P extends number | string, R> (bulkGet: (params: P[]) => Observable<R>) {
109 const notifier = new Subject<T>() 110 const notifier = new Subject<P>()
110 111
111 return { 112 return {
112 notifier, 113 notifier,