diff options
author | Chocobozzz <me@florianbigard.com> | 2022-01-31 11:15:44 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-01-31 11:15:44 +0100 |
commit | 8d9c10bc51d5200175811408578b826fd2cb00bf (patch) | |
tree | 469cba5b5babd4900e7b3046600a5cc4df6100c7 /client | |
parent | 228d8e8e47e913fc6487a917d43a59070aefa0ab (diff) | |
download | PeerTube-8d9c10bc51d5200175811408578b826fd2cb00bf.tar.gz PeerTube-8d9c10bc51d5200175811408578b826fd2cb00bf.tar.zst PeerTube-8d9c10bc51d5200175811408578b826fd2cb00bf.zip |
Limit scope to local when finding in bulk
Diffstat (limited to 'client')
-rw-r--r-- | client/src/app/shared/shared-search/find-in-bulk.service.ts | 23 |
1 files changed, 20 insertions, 3 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 8ca64c37e..117685cc6 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 | |||
@@ -7,6 +7,7 @@ import { ResultList } from '@shared/models/common' | |||
7 | import { Video, VideoChannel } from '../shared-main' | 7 | import { Video, VideoChannel } from '../shared-main' |
8 | import { VideoPlaylist } from '../shared-video-playlist' | 8 | import { VideoPlaylist } from '../shared-video-playlist' |
9 | import { SearchService } from './search.service' | 9 | import { SearchService } from './search.service' |
10 | import { AdvancedSearch } from './advanced-search.model' | ||
10 | 11 | ||
11 | const logger = debug('peertube:search:FindInBulkService') | 12 | const logger = debug('peertube:search:FindInBulkService') |
12 | 13 | ||
@@ -18,6 +19,8 @@ type BulkObservables <P extends number | string, R> = { | |||
18 | @Injectable() | 19 | @Injectable() |
19 | export class FindInBulkService { | 20 | export class FindInBulkService { |
20 | 21 | ||
22 | private advancedSearchForBulk: AdvancedSearch | ||
23 | |||
21 | private getVideoInBulk: BulkObservables<string, ResultList<Video>> | 24 | private getVideoInBulk: BulkObservables<string, ResultList<Video>> |
22 | private getChannelInBulk: BulkObservables<string, ResultList<VideoChannel>> | 25 | private getChannelInBulk: BulkObservables<string, ResultList<VideoChannel>> |
23 | private getPlaylistInBulk: BulkObservables<string, ResultList<VideoPlaylist>> | 26 | private getPlaylistInBulk: BulkObservables<string, ResultList<VideoPlaylist>> |
@@ -28,6 +31,8 @@ export class FindInBulkService { | |||
28 | this.getVideoInBulk = this.buildBulkObservableObject(this.getVideosInBulk.bind(this)) | 31 | this.getVideoInBulk = this.buildBulkObservableObject(this.getVideosInBulk.bind(this)) |
29 | this.getChannelInBulk = this.buildBulkObservableObject(this.getChannelsInBulk.bind(this)) | 32 | this.getChannelInBulk = this.buildBulkObservableObject(this.getChannelsInBulk.bind(this)) |
30 | this.getPlaylistInBulk = this.buildBulkObservableObject(this.getPlaylistsInBulk.bind(this)) | 33 | this.getPlaylistInBulk = this.buildBulkObservableObject(this.getPlaylistsInBulk.bind(this)) |
34 | |||
35 | this.advancedSearchForBulk = new AdvancedSearch({ searchTarget: 'local' }) | ||
31 | } | 36 | } |
32 | 37 | ||
33 | getVideo (uuid: string): Observable<Video> { | 38 | getVideo (uuid: string): Observable<Video> { |
@@ -91,19 +96,31 @@ export class FindInBulkService { | |||
91 | private getVideosInBulk (uuids: string[]) { | 96 | private getVideosInBulk (uuids: string[]) { |
92 | logger('Fetching videos %s.', uuids.join(', ')) | 97 | logger('Fetching videos %s.', uuids.join(', ')) |
93 | 98 | ||
94 | return this.searchService.searchVideos({ uuids, componentPagination: { itemsPerPage: uuids.length, currentPage: 1 } }) | 99 | return this.searchService.searchVideos({ |
100 | uuids, | ||
101 | componentPagination: { itemsPerPage: uuids.length, currentPage: 1 }, | ||
102 | advancedSearch: this.advancedSearchForBulk | ||
103 | }) | ||
95 | } | 104 | } |
96 | 105 | ||
97 | private getChannelsInBulk (handles: string[]) { | 106 | private getChannelsInBulk (handles: string[]) { |
98 | logger('Fetching channels %s.', handles.join(', ')) | 107 | logger('Fetching channels %s.', handles.join(', ')) |
99 | 108 | ||
100 | return this.searchService.searchVideoChannels({ handles, componentPagination: { itemsPerPage: handles.length, currentPage: 1 } }) | 109 | return this.searchService.searchVideoChannels({ |
110 | handles, | ||
111 | componentPagination: { itemsPerPage: handles.length, currentPage: 1 }, | ||
112 | advancedSearch: this.advancedSearchForBulk | ||
113 | }) | ||
101 | } | 114 | } |
102 | 115 | ||
103 | private getPlaylistsInBulk (uuids: string[]) { | 116 | private getPlaylistsInBulk (uuids: string[]) { |
104 | logger('Fetching playlists %s.', uuids.join(', ')) | 117 | logger('Fetching playlists %s.', uuids.join(', ')) |
105 | 118 | ||
106 | return this.searchService.searchVideoPlaylists({ uuids, componentPagination: { itemsPerPage: uuids.length, currentPage: 1 } }) | 119 | return this.searchService.searchVideoPlaylists({ |
120 | uuids, | ||
121 | componentPagination: { itemsPerPage: uuids.length, currentPage: 1 }, | ||
122 | advancedSearch: this.advancedSearchForBulk | ||
123 | }) | ||
107 | } | 124 | } |
108 | 125 | ||
109 | private buildBulkObservableObject <P extends number | string, R> (bulkGet: (params: P[]) => Observable<R>) { | 126 | private buildBulkObservableObject <P extends number | string, R> (bulkGet: (params: P[]) => Observable<R>) { |