X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fcore%2Frest%2Frest.service.ts;h=59152e65855bee70df5ae0b6f300222b9fb64db3;hb=231ff4af3bdb864d6bc66e487b12275e5f1fb44f;hp=93b5f56b2b402d8e7135b92c3fd4f3be7f7de754;hpb=61f85385bbd281e34573e250b2625860fd6a1408;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/core/rest/rest.service.ts b/client/src/app/core/rest/rest.service.ts index 93b5f56b2..59152e658 100644 --- a/client/src/app/core/rest/rest.service.ts +++ b/client/src/app/core/rest/rest.service.ts @@ -1,13 +1,16 @@ +import * as debug from 'debug' import { SortMeta } from 'primeng/api' import { HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' import { ComponentPaginationLight } from './component-pagination.model' import { RestPagination } from './rest-pagination' +const logger = debug('peertube:rest') + interface QueryStringFilterPrefixes { [key: string]: { prefix: string - handler?: (v: string) => string | number + handler?: (v: string) => string | number | boolean multiple?: boolean isBoolean?: boolean } @@ -87,6 +90,8 @@ export class RestService { const prefixeStrings = Object.values(prefixes) .map(p => p.prefix) + logger(`Built tokens "${tokens.join(', ')}" for prefixes "${prefixeStrings.join(', ')}"`) + // Search is the querystring minus defined filters const searchTokens = tokens.filter(t => { return prefixeStrings.every(prefixString => t.startsWith(prefixString) === false) @@ -122,8 +127,12 @@ export class RestService { : matchedTokens[0] } + const search = searchTokens.join(' ') || undefined + + logger('Built search: ' + search, additionalFilters) + return { - search: searchTokens.join(' ') || undefined, + search, ...additionalFilters }