X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-search%2Fadvanced-search.model.ts;h=29fe3e8dc9e7ed3b348cf48d6c23c1f8fb50af68;hb=52798aa5f277492d4dd2482bca9396d2e982fa19;hp=1375820da12d0826947be111422c68f0e292475f;hpb=55269c0460207ebd924fedeeb88fc0bca973b96d;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/shared-search/advanced-search.model.ts b/client/src/app/shared/shared-search/advanced-search.model.ts index 1375820da..29fe3e8dc 100644 --- a/client/src/app/shared/shared-search/advanced-search.model.ts +++ b/client/src/app/shared/shared-search/advanced-search.model.ts @@ -1,4 +1,4 @@ -import { intoArray } from '@app/helpers' +import { splitIntoArray } from '@app/helpers' import { BooleanBothQuery, BooleanQuery, @@ -40,6 +40,8 @@ export class AdvancedSearch { searchTarget: SearchTargetType resultType: AdvancedSearchResultType + excludeAlreadyWatched?: boolean + constructor (options?: { startDate?: string endDate?: string @@ -62,6 +64,8 @@ export class AdvancedSearch { sort?: string searchTarget?: SearchTargetType resultType?: AdvancedSearchResultType + + excludeAlreadyWatched?: boolean }) { if (!options) return @@ -76,8 +80,8 @@ export class AdvancedSearch { this.categoryOneOf = options.categoryOneOf || undefined this.licenceOneOf = options.licenceOneOf || undefined this.languageOneOf = options.languageOneOf || undefined - this.tagsOneOf = intoArray(options.tagsOneOf) - this.tagsAllOf = intoArray(options.tagsAllOf) + this.tagsOneOf = splitIntoArray(options.tagsOneOf) + this.tagsAllOf = splitIntoArray(options.tagsAllOf) this.durationMin = options.durationMin ? parseInt(options.durationMin, 10) : undefined this.durationMax = options.durationMax ? parseInt(options.durationMax, 10) : undefined @@ -87,6 +91,8 @@ export class AdvancedSearch { this.resultType = options.resultType || undefined + this.excludeAlreadyWatched = options.excludeAlreadyWatched || undefined + if (!this.resultType && this.hasVideoFilter()) { this.resultType = 'videos' } @@ -138,7 +144,8 @@ export class AdvancedSearch { host: this.host, sort: this.sort, searchTarget: this.searchTarget, - resultType: this.resultType + resultType: this.resultType, + excludeAlreadyWatched: this.excludeAlreadyWatched } } @@ -152,9 +159,9 @@ export class AdvancedSearch { originallyPublishedStartDate: this.originallyPublishedStartDate, originallyPublishedEndDate: this.originallyPublishedEndDate, nsfw: this.nsfw, - categoryOneOf: intoArray(this.categoryOneOf), - licenceOneOf: intoArray(this.licenceOneOf), - languageOneOf: intoArray(this.languageOneOf), + categoryOneOf: splitIntoArray(this.categoryOneOf), + licenceOneOf: splitIntoArray(this.licenceOneOf), + languageOneOf: splitIntoArray(this.languageOneOf), tagsOneOf: this.tagsOneOf, tagsAllOf: this.tagsAllOf, durationMin: this.durationMin, @@ -162,7 +169,8 @@ export class AdvancedSearch { host: this.host, isLive, sort: this.sort, - searchTarget: this.searchTarget + searchTarget: this.searchTarget, + excludeAlreadyWatched: this.excludeAlreadyWatched } } @@ -221,7 +229,6 @@ export class AdvancedSearch { this.tagsAllOf !== undefined || this.durationMin !== undefined || this.durationMax !== undefined || - this.host !== undefined || this.isLive !== undefined } }