From e0a929179a9dc76e035ca7fda2b61d5ff46afbc5 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Sun, 19 Apr 2020 14:11:40 +0200 Subject: Add filter inputs for blacklisted videos and muted accounts/servers --- client/src/app/shared/blocklist/blocklist.service.ts | 12 ++++++++++-- .../app/shared/video-blacklist/video-blacklist.service.ts | 14 ++++++++++---- 2 files changed, 20 insertions(+), 6 deletions(-) (limited to 'client/src/app/shared') diff --git a/client/src/app/shared/blocklist/blocklist.service.ts b/client/src/app/shared/blocklist/blocklist.service.ts index c1f7312f0..5cf265bc1 100644 --- a/client/src/app/shared/blocklist/blocklist.service.ts +++ b/client/src/app/shared/blocklist/blocklist.service.ts @@ -76,10 +76,14 @@ export class BlocklistService { /*********************** Instance -> Account blocklist ***********************/ - getInstanceAccountBlocklist (pagination: RestPagination, sort: SortMeta) { + getInstanceAccountBlocklist (options: { pagination: RestPagination, sort: SortMeta, search: string }) { + const { pagination, sort, search } = options + let params = new HttpParams() params = this.restService.addRestGetParams(params, pagination, sort) + if (search) params = params.append('search', search) + return this.authHttp.get>(BlocklistService.BASE_SERVER_BLOCKLIST_URL + '/accounts', { params }) .pipe( map(res => this.restExtractor.convertResultListDateToHuman(res)), @@ -104,10 +108,14 @@ export class BlocklistService { /*********************** Instance -> Server blocklist ***********************/ - getInstanceServerBlocklist (pagination: RestPagination, sort: SortMeta) { + getInstanceServerBlocklist (options: { pagination: RestPagination, sort: SortMeta, search: string }) { + const { pagination, sort, search } = options + let params = new HttpParams() params = this.restService.addRestGetParams(params, pagination, sort) + if (search) params = params.append('search', search) + return this.authHttp.get>(BlocklistService.BASE_SERVER_BLOCKLIST_URL + '/servers', { params }) .pipe( map(res => this.restExtractor.convertResultListDateToHuman(res)), diff --git a/client/src/app/shared/video-blacklist/video-blacklist.service.ts b/client/src/app/shared/video-blacklist/video-blacklist.service.ts index 116177c4a..c0e13a651 100644 --- a/client/src/app/shared/video-blacklist/video-blacklist.service.ts +++ b/client/src/app/shared/video-blacklist/video-blacklist.service.ts @@ -19,13 +19,19 @@ export class VideoBlacklistService { private restExtractor: RestExtractor ) {} - listBlacklist (pagination: RestPagination, sort: SortMeta, type?: VideoBlacklistType): Observable> { + listBlacklist (options: { + pagination: RestPagination, + sort: SortMeta, + search?: string + type?: VideoBlacklistType + }): Observable> { + const { pagination, sort, search, type } = options + let params = new HttpParams() params = this.restService.addRestGetParams(params, pagination, sort) - if (type) { - params = params.set('type', type.toString()) - } + if (search) params = params.append('search', search) + if (type) params = params.append('type', type.toString()) return this.authHttp.get>(VideoBlacklistService.BASE_VIDEOS_URL + 'blacklist', { params }) .pipe( -- cgit v1.2.3