aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-search
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-08-19 09:24:29 +0200
committerChocobozzz <me@florianbigard.com>2021-08-25 11:24:11 +0200
commitdd24f1bb0a4b252e5342b251ba36853364da7b8e (patch)
tree41a9506d07413f056fb90425705e258f96fdc77d /client/src/app/shared/shared-search
parent2e80d256cc75b4b02c8efc3d3e4cdf57ddf401a8 (diff)
downloadPeerTube-dd24f1bb0a4b252e5342b251ba36853364da7b8e.tar.gz
PeerTube-dd24f1bb0a4b252e5342b251ba36853364da7b8e.tar.zst
PeerTube-dd24f1bb0a4b252e5342b251ba36853364da7b8e.zip
Add video filters to common video pages
Diffstat (limited to 'client/src/app/shared/shared-search')
-rw-r--r--client/src/app/shared/shared-search/advanced-search.model.ts20
1 files changed, 6 insertions, 14 deletions
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 9c55f6cd8..2675c6135 100644
--- a/client/src/app/shared/shared-search/advanced-search.model.ts
+++ b/client/src/app/shared/shared-search/advanced-search.model.ts
@@ -1,3 +1,4 @@
1import { intoArray } from '@app/helpers'
1import { 2import {
2 BooleanBothQuery, 3 BooleanBothQuery,
3 BooleanQuery, 4 BooleanQuery,
@@ -74,8 +75,8 @@ export class AdvancedSearch {
74 this.categoryOneOf = options.categoryOneOf || undefined 75 this.categoryOneOf = options.categoryOneOf || undefined
75 this.licenceOneOf = options.licenceOneOf || undefined 76 this.licenceOneOf = options.licenceOneOf || undefined
76 this.languageOneOf = options.languageOneOf || undefined 77 this.languageOneOf = options.languageOneOf || undefined
77 this.tagsOneOf = this.intoArray(options.tagsOneOf) 78 this.tagsOneOf = intoArray(options.tagsOneOf)
78 this.tagsAllOf = this.intoArray(options.tagsAllOf) 79 this.tagsAllOf = intoArray(options.tagsAllOf)
79 this.durationMin = parseInt(options.durationMin, 10) 80 this.durationMin = parseInt(options.durationMin, 10)
80 this.durationMax = parseInt(options.durationMax, 10) 81 this.durationMax = parseInt(options.durationMax, 10)
81 82
@@ -150,9 +151,9 @@ export class AdvancedSearch {
150 originallyPublishedStartDate: this.originallyPublishedStartDate, 151 originallyPublishedStartDate: this.originallyPublishedStartDate,
151 originallyPublishedEndDate: this.originallyPublishedEndDate, 152 originallyPublishedEndDate: this.originallyPublishedEndDate,
152 nsfw: this.nsfw, 153 nsfw: this.nsfw,
153 categoryOneOf: this.intoArray(this.categoryOneOf), 154 categoryOneOf: intoArray(this.categoryOneOf),
154 licenceOneOf: this.intoArray(this.licenceOneOf), 155 licenceOneOf: intoArray(this.licenceOneOf),
155 languageOneOf: this.intoArray(this.languageOneOf), 156 languageOneOf: intoArray(this.languageOneOf),
156 tagsOneOf: this.tagsOneOf, 157 tagsOneOf: this.tagsOneOf,
157 tagsAllOf: this.tagsAllOf, 158 tagsAllOf: this.tagsAllOf,
158 durationMin: this.durationMin, 159 durationMin: this.durationMin,
@@ -198,13 +199,4 @@ export class AdvancedSearch {
198 199
199 return true 200 return true
200 } 201 }
201
202 private intoArray (value: any) {
203 if (!value) return undefined
204 if (Array.isArray(value)) return value
205
206 if (typeof value === 'string') return value.split(',')
207
208 return [ value ]
209 }
210} 202}