aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-01-31 11:15:44 +0100
committerChocobozzz <me@florianbigard.com>2022-01-31 11:15:44 +0100
commit8d9c10bc51d5200175811408578b826fd2cb00bf (patch)
tree469cba5b5babd4900e7b3046600a5cc4df6100c7 /client/src/app/shared
parent228d8e8e47e913fc6487a917d43a59070aefa0ab (diff)
downloadPeerTube-8d9c10bc51d5200175811408578b826fd2cb00bf.tar.gz
PeerTube-8d9c10bc51d5200175811408578b826fd2cb00bf.tar.zst
PeerTube-8d9c10bc51d5200175811408578b826fd2cb00bf.zip
Limit scope to local when finding in bulk
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/shared-search/find-in-bulk.service.ts23
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'
7import { Video, VideoChannel } from '../shared-main' 7import { Video, VideoChannel } from '../shared-main'
8import { VideoPlaylist } from '../shared-video-playlist' 8import { VideoPlaylist } from '../shared-video-playlist'
9import { SearchService } from './search.service' 9import { SearchService } from './search.service'
10import { AdvancedSearch } from './advanced-search.model'
10 11
11const logger = debug('peertube:search:FindInBulkService') 12const logger = debug('peertube:search:FindInBulkService')
12 13
@@ -18,6 +19,8 @@ type BulkObservables <P extends number | string, R> = {
18@Injectable() 19@Injectable()
19export class FindInBulkService { 20export 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>) {