]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/search/advanced-search.model.ts
Add ability to click on category/licence/language/tags in watch page
[github/Chocobozzz/PeerTube.git] / client / src / app / search / advanced-search.model.ts
index ce22c3f84e290f39bab31bf43fa8868a796a4862..48616a9ae2161e12d858fc717b7eca7921ebf41c 100644 (file)
@@ -99,14 +99,22 @@ export class AdvancedSearch {
       startDate: this.startDate,
       endDate: this.endDate,
       nsfw: this.nsfw,
-      categoryOneOf: this.categoryOneOf ? this.categoryOneOf.split(',') : undefined,
-      licenceOneOf: this.licenceOneOf ? this.licenceOneOf.split(',') : undefined,
-      languageOneOf: this.languageOneOf ? this.languageOneOf.split(',') : undefined,
-      tagsOneOf: this.tagsOneOf ? this.tagsOneOf.split(',') : undefined,
-      tagsAllOf: this.tagsAllOf ? this.tagsAllOf.split(',') : undefined,
+      categoryOneOf: this.intoArray(this.categoryOneOf),
+      licenceOneOf: this.intoArray(this.licenceOneOf),
+      languageOneOf: this.intoArray(this.languageOneOf),
+      tagsOneOf: this.intoArray(this.tagsOneOf),
+      tagsAllOf: this.intoArray(this.tagsAllOf),
       durationMin: this.durationMin,
       durationMax: this.durationMax,
       sort: this.sort
     }
   }
+
+  private intoArray (value: any) {
+    if (!value) return undefined
+
+    if (typeof value === 'string') return value.split(',')
+
+    return [ value ]
+  }
 }