diff options
author | Chocobozzz <me@florianbigard.com> | 2021-08-02 16:50:56 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-08-02 17:10:07 +0200 |
commit | ff4de38385049bf8f6e1d76d8511854fcfabc71c (patch) | |
tree | 217dba89333609fc0255c2efbc38c0e7a8379bb8 /client/src/app/shared/shared-search | |
parent | 3da38d6e9f8d600476be276666ac7223aa5f172c (diff) | |
download | PeerTube-ff4de38385049bf8f6e1d76d8511854fcfabc71c.tar.gz PeerTube-ff4de38385049bf8f6e1d76d8511854fcfabc71c.tar.zst PeerTube-ff4de38385049bf8f6e1d76d8511854fcfabc71c.zip |
Filter videos by live in custom markup
Diffstat (limited to 'client/src/app/shared/shared-search')
-rw-r--r-- | client/src/app/shared/shared-search/find-in-bulk.service.ts | 13 |
1 files changed, 9 insertions, 4 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 0383d8648..61dd2cbc5 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 @@ | |||
1 | import * as debug from 'debug' | 1 | import * as debug from 'debug' |
2 | import { Observable, Subject } from 'rxjs' | 2 | import { Observable, Subject, throwError } from 'rxjs' |
3 | import { map } from 'rxjs/operators' | 3 | import { first, map } from 'rxjs/operators' |
4 | import { Injectable, NgZone } from '@angular/core' | 4 | import { Injectable, NgZone } from '@angular/core' |
5 | import { buildBulkObservable } from '@app/helpers' | 5 | import { buildBulkObservable } from '@app/helpers' |
6 | import { ResultList } from '@shared/models/common' | 6 | import { ResultList } from '@shared/models/common' |
@@ -71,12 +71,17 @@ export class FindInBulkService { | |||
71 | return new Observable<R>(obs => { | 71 | return new Observable<R>(obs => { |
72 | observableObject.result | 72 | observableObject.result |
73 | .pipe( | 73 | .pipe( |
74 | first(), | ||
74 | map(({ data }) => data), | 75 | map(({ data }) => data), |
75 | map(data => data.find(finder)) | 76 | map(data => data.find(finder)) |
76 | ) | 77 | ) |
77 | .subscribe(result => { | 78 | .subscribe(result => { |
78 | obs.next(result) | 79 | if (!result) { |
79 | obs.complete() | 80 | obs.error(new Error($localize`Element ${param} not found`)) |
81 | } else { | ||
82 | obs.next(result) | ||
83 | obs.complete() | ||
84 | } | ||
80 | }) | 85 | }) |
81 | 86 | ||
82 | observableObject.notifier.next(param) | 87 | observableObject.notifier.next(param) |