X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fcore%2Fserver%2Fserver.service.ts;h=7b11c068ee1ad0ea52e54c7b351f9b67aec8b28f;hb=ad77475251c3516dd5851a08655be79d7bf76245;hp=74363e6a1bac7eedeb7627c3319ae7d3f977d147;hpb=74b7c6d48e9ca377fe938c8134ed74b612e62ba0;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts index 74363e6a1..7b11c068e 100644 --- a/client/src/app/core/server/server.service.ts +++ b/client/src/app/core/server/server.service.ts @@ -2,13 +2,14 @@ import { map, share, switchMap, tap } from 'rxjs/operators' import { HttpClient } from '@angular/common/http' import { Inject, Injectable, LOCALE_ID } from '@angular/core' import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' -import { Observable, ReplaySubject, of } from 'rxjs' +import { Observable, of, ReplaySubject } from 'rxjs' import { getCompleteLocale, ServerConfig } from '../../../../../shared' import { About } from '../../../../../shared/models/server/about.model' import { environment } from '../../../environments/environment' -import { VideoConstant, VideoPrivacy } from '../../../../../shared/models/videos' +import { VideoConstant } from '../../../../../shared/models/videos' import { isDefaultLocale } from '../../../../../shared/models/i18n' import { getDevLocale, isOnDevLocale, peertubeTranslate } from '@app/shared/i18n/i18n-utils' +import { sortBy } from '@app/shared/misc/utils' @Injectable() export class ServerService { @@ -59,14 +60,20 @@ export class ServerService { extensions: [] } }, + videoCaption: { + file: { + size: { max: 0 }, + extensions: [] + } + }, user: { videoQuota: -1 } } - private videoCategories: Array> = [] - private videoLicences: Array> = [] + private videoCategories: Array> = [] + private videoLicences: Array> = [] private videoLanguages: Array> = [] - private videoPrivacies: Array> = [] + private videoPrivacies: Array> = [] constructor ( private http: HttpClient, @@ -128,7 +135,7 @@ export class ServerService { private loadVideoAttributeEnum ( attributeName: 'categories' | 'licences' | 'languages' | 'privacies', - hashToPopulate: VideoConstant[], + hashToPopulate: VideoConstant[], notifier: ReplaySubject, sort = false ) { @@ -150,13 +157,7 @@ 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 - }) - } + if (sort === true) sortBy(hashToPopulate, 'label') notifier.next(true) })