From ad77475251c3516dd5851a08655be79d7bf76245 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 25 Jul 2018 15:11:25 +0200 Subject: Sort video captions --- client/src/app/core/server/server.service.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'client/src/app/core') diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts index 87280e16f..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 { @@ -156,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) }) -- cgit v1.2.3