diff options
author | Chocobozzz <me@florianbigard.com> | 2020-08-14 17:28:54 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-08-14 17:28:54 +0200 |
commit | b4c3c51dc874711febf43b719ca878436b31084d (patch) | |
tree | 19cc50cc8e28c9de33f001595a4c6d4ced9690cf /client/src/app/core | |
parent | 93e903ac165eed918986e415127d6ea9730e572c (diff) | |
download | PeerTube-b4c3c51dc874711febf43b719ca878436b31084d.tar.gz PeerTube-b4c3c51dc874711febf43b719ca878436b31084d.tar.zst PeerTube-b4c3c51dc874711febf43b719ca878436b31084d.zip |
Fix circular dependencies
Diffstat (limited to 'client/src/app/core')
-rw-r--r-- | client/src/app/core/users/user.service.ts | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/client/src/app/core/users/user.service.ts b/client/src/app/core/users/user.service.ts index 01c9be5bf..2f3945169 100644 --- a/client/src/app/core/users/user.service.ts +++ b/client/src/app/core/users/user.service.ts | |||
@@ -4,7 +4,7 @@ import { catchError, concatMap, filter, first, map, shareReplay, throttleTime, t | |||
4 | import { HttpClient, HttpParams } from '@angular/common/http' | 4 | import { HttpClient, HttpParams } from '@angular/common/http' |
5 | import { Injectable } from '@angular/core' | 5 | import { Injectable } from '@angular/core' |
6 | import { AuthService } from '@app/core/auth' | 6 | import { AuthService } from '@app/core/auth' |
7 | import { BytesPipe } from '@app/shared/shared-main' | 7 | import { getBytes } from '@root-helpers/bytes' |
8 | import { UserLocalStorageKeys } from '@root-helpers/users' | 8 | import { UserLocalStorageKeys } from '@root-helpers/users' |
9 | import { | 9 | import { |
10 | Avatar, | 10 | Avatar, |
@@ -27,8 +27,6 @@ import { User } from './user.model' | |||
27 | export class UserService { | 27 | export class UserService { |
28 | static BASE_USERS_URL = environment.apiUrl + '/api/v1/users/' | 28 | static BASE_USERS_URL = environment.apiUrl + '/api/v1/users/' |
29 | 29 | ||
30 | private bytesPipe = new BytesPipe() | ||
31 | |||
32 | private userCache: { [ id: number ]: Observable<UserServerModel> } = {} | 30 | private userCache: { [ id: number ]: Observable<UserServerModel> } = {} |
33 | 31 | ||
34 | constructor ( | 32 | constructor ( |
@@ -365,19 +363,19 @@ export class UserService { | |||
365 | if (user.videoQuota === -1) { | 363 | if (user.videoQuota === -1) { |
366 | videoQuota = '∞' | 364 | videoQuota = '∞' |
367 | } else { | 365 | } else { |
368 | videoQuota = this.bytesPipe.transform(user.videoQuota, 0) | 366 | videoQuota = getBytes(user.videoQuota, 0) |
369 | } | 367 | } |
370 | 368 | ||
371 | const videoQuotaUsed = this.bytesPipe.transform(user.videoQuotaUsed, 0) | 369 | const videoQuotaUsed = getBytes(user.videoQuotaUsed, 0) |
372 | 370 | ||
373 | let videoQuotaDaily: string | 371 | let videoQuotaDaily: string |
374 | let videoQuotaUsedDaily: string | 372 | let videoQuotaUsedDaily: string |
375 | if (user.videoQuotaDaily === -1) { | 373 | if (user.videoQuotaDaily === -1) { |
376 | videoQuotaDaily = '∞' | 374 | videoQuotaDaily = '∞' |
377 | videoQuotaUsedDaily = this.bytesPipe.transform(0, 0) + '' | 375 | videoQuotaUsedDaily = getBytes(0, 0) + '' |
378 | } else { | 376 | } else { |
379 | videoQuotaDaily = this.bytesPipe.transform(user.videoQuotaDaily, 0) + '' | 377 | videoQuotaDaily = getBytes(user.videoQuotaDaily, 0) + '' |
380 | videoQuotaUsedDaily = this.bytesPipe.transform(user.videoQuotaUsedDaily || 0, 0) + '' | 378 | videoQuotaUsedDaily = getBytes(user.videoQuotaUsedDaily || 0, 0) + '' |
381 | } | 379 | } |
382 | 380 | ||
383 | const roleLabels: { [ id in UserRole ]: string } = { | 381 | const roleLabels: { [ id in UserRole ]: string } = { |