Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Sort video categories/languages

Chocobozzz3580fc00e44d
diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts
index 553ad8af6f..f54e63efd5 100644
--- a/client/src/app/core/server/server.service.ts
+++ b/client/src/app/core/server/server.service.ts
@@ -60,7 +60,7 @@ export class ServerService {
}
loadVideoCategories () {
- return this.loadVideoAttributeEnum('categories', this.videoCategories, this.videoCategoriesLoaded)
+ return this.loadVideoAttributeEnum('categories', this.videoCategories, this.videoCategoriesLoaded, true)
}
loadVideoLicences () {
@@ -68,7 +68,7 @@ export class ServerService {
}
loadVideoLanguages () {
- return this.loadVideoAttributeEnum('languages', this.videoLanguages, this.videoLanguagesLoaded)
+ return this.loadVideoAttributeEnum('languages', this.videoLanguages, this.videoLanguagesLoaded, true)
}
loadVideoPrivacies () {
@@ -102,7 +102,8 @@ export class ServerService {
private loadVideoAttributeEnum (
attributeName: 'categories' | 'licences' | 'languages' | 'privacies',
hashToPopulate: { id: number, label: string }[],
- notifier: ReplaySubject<boolean>
+ notifier: ReplaySubject<boolean>,
+ sort = false
) {
return this.http.get(ServerService.BASE_VIDEO_URL + attributeName)
.subscribe(data => {
@@ -114,6 +115,14 @@ export class ServerService {
})
})
+ if (sort === true) {
+ hashToPopulate.sort((a, b) => {
+ if (a.label < b.label) return -1
+ if (a.label === b.label) return 0
+ return 1
+ })
+ }
+
notifier.next(true)
})
}