From d8b3436f687034948964627cce88148daf7fb4eb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 9 Dec 2024 09:50:27 +0100 Subject: [PATCH] Allow to pass client params when listing videos --- .../app/shared/shared-main/video/video.service.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.ts index 28ef60d6d..ac6584a22 100644 --- a/client/src/app/shared/shared-main/video/video.service.ts +++ b/client/src/app/shared/shared-main/video/video.service.ts @@ -51,6 +51,7 @@ export type CommonVideoParams = { isLive?: boolean skipCount?: boolean nsfw?: BooleanBothQuery + search?: string } @Injectable() @@ -178,15 +179,12 @@ export class VideoService { getAccountVideos (parameters: CommonVideoParams & { account: Pick - search?: string }): Observable> { - const { account, search } = parameters + const { account } = parameters let params = new HttpParams() params = this.buildCommonVideosParams({ params, ...parameters }) - if (search) params = params.set('search', search) - return this.authHttp .get>(AccountService.BASE_ACCOUNT_URL + account.nameWithHost + '/videos', { params }) .pipe( @@ -548,7 +546,10 @@ export class VideoService { privacyOneOf, skipCount, isLive, - nsfw + nsfw, + search, + + ...otherOptions } = options const pagination = videoPagination @@ -566,6 +567,9 @@ export class VideoService { if (languageOneOf !== undefined) newParams = this.restService.addArrayParams(newParams, 'languageOneOf', languageOneOf) if (categoryOneOf !== undefined) newParams = this.restService.addArrayParams(newParams, 'categoryOneOf', categoryOneOf) if (privacyOneOf !== undefined) newParams = this.restService.addArrayParams(newParams, 'privacyOneOf', privacyOneOf) + if (search) newParams = newParams.set('search', search) + + newParams = this.restService.addObjectParams(newParams, otherOptions) return newParams }