diff options
author | Chocobozzz <me@florianbigard.com> | 2019-06-19 14:55:58 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-06-19 15:05:36 +0200 |
commit | 3caf77d3b11f2dbc12e52d665183d36604c1dab9 (patch) | |
tree | 53e08727d5f1dc8be2bd4f4a14dadc05f607a9fb /client/src/app/shared/video/video.service.ts | |
parent | bbe078ba55be635b5fc92f8f6286c45792b9e7e5 (diff) | |
download | PeerTube-3caf77d3b11f2dbc12e52d665183d36604c1dab9.tar.gz PeerTube-3caf77d3b11f2dbc12e52d665183d36604c1dab9.tar.zst PeerTube-3caf77d3b11f2dbc12e52d665183d36604c1dab9.zip |
Add language filters in user preferences
Diffstat (limited to 'client/src/app/shared/video/video.service.ts')
-rw-r--r-- | client/src/app/shared/video/video.service.ts | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts index ef489648c..871bc9e46 100644 --- a/client/src/app/shared/video/video.service.ts +++ b/client/src/app/shared/video/video.service.ts | |||
@@ -35,12 +35,13 @@ import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' | |||
35 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' | 35 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' |
36 | 36 | ||
37 | export interface VideosProvider { | 37 | export interface VideosProvider { |
38 | getVideos ( | 38 | getVideos (parameters: { |
39 | videoPagination: ComponentPagination, | 39 | videoPagination: ComponentPagination, |
40 | sort: VideoSortField, | 40 | sort: VideoSortField, |
41 | filter?: VideoFilter, | 41 | filter?: VideoFilter, |
42 | categoryOneOf?: number | 42 | categoryOneOf?: number, |
43 | ): Observable<{ videos: Video[], totalVideos: number }> | 43 | languageOneOf?: string[] |
44 | }): Observable<{ videos: Video[], totalVideos: number }> | ||
44 | } | 45 | } |
45 | 46 | ||
46 | @Injectable() | 47 | @Injectable() |
@@ -206,12 +207,15 @@ export class VideoService implements VideosProvider { | |||
206 | ) | 207 | ) |
207 | } | 208 | } |
208 | 209 | ||
209 | getVideos ( | 210 | getVideos (parameters: { |
210 | videoPagination: ComponentPagination, | 211 | videoPagination: ComponentPagination, |
211 | sort: VideoSortField, | 212 | sort: VideoSortField, |
212 | filter?: VideoFilter, | 213 | filter?: VideoFilter, |
213 | categoryOneOf?: number | 214 | categoryOneOf?: number, |
214 | ): Observable<{ videos: Video[], totalVideos: number }> { | 215 | languageOneOf?: string[] |
216 | }): Observable<{ videos: Video[], totalVideos: number }> { | ||
217 | const { videoPagination, sort, filter, categoryOneOf, languageOneOf } = parameters | ||
218 | |||
215 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) | 219 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) |
216 | 220 | ||
217 | let params = new HttpParams() | 221 | let params = new HttpParams() |
@@ -225,6 +229,12 @@ export class VideoService implements VideosProvider { | |||
225 | params = params.set('categoryOneOf', categoryOneOf + '') | 229 | params = params.set('categoryOneOf', categoryOneOf + '') |
226 | } | 230 | } |
227 | 231 | ||
232 | if (languageOneOf) { | ||
233 | for (const l of languageOneOf) { | ||
234 | params = params.append('languageOneOf[]', l) | ||
235 | } | ||
236 | } | ||
237 | |||
228 | return this.authHttp | 238 | return this.authHttp |
229 | .get<ResultList<Video>>(VideoService.BASE_VIDEO_URL, { params }) | 239 | .get<ResultList<Video>>(VideoService.BASE_VIDEO_URL, { params }) |
230 | .pipe( | 240 | .pipe( |