diff options
Diffstat (limited to 'client/src/app/+my-account/my-account-settings/my-account-settings.component.ts')
-rw-r--r-- | client/src/app/+my-account/my-account-settings/my-account-settings.component.ts | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts index a9a150e21..a3a8ff1f1 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts | |||
@@ -1,4 +1,3 @@ | |||
1 | import { BytesPipe } from 'ngx-pipes' | ||
2 | import { ViewportScroller } from '@angular/common' | 1 | import { ViewportScroller } from '@angular/common' |
3 | import { AfterViewChecked, Component, OnInit } from '@angular/core' | 2 | import { AfterViewChecked, Component, OnInit } from '@angular/core' |
4 | import { AuthService, Notifier, User, UserService } from '@app/core' | 3 | import { AuthService, Notifier, User, UserService } from '@app/core' |
@@ -12,14 +11,6 @@ import { I18n } from '@ngx-translate/i18n-polyfill' | |||
12 | export class MyAccountSettingsComponent implements OnInit, AfterViewChecked { | 11 | export class MyAccountSettingsComponent implements OnInit, AfterViewChecked { |
13 | user: User = null | 12 | user: User = null |
14 | 13 | ||
15 | userVideoQuota = '0' | ||
16 | userVideoQuotaUsed = 0 | ||
17 | userVideoQuotaPercentage = 15 | ||
18 | |||
19 | userVideoQuotaDaily = '0' | ||
20 | userVideoQuotaUsedDaily = 0 | ||
21 | userVideoQuotaDailyPercentage = 15 | ||
22 | |||
23 | private lastScrollHash: string | 14 | private lastScrollHash: string |
24 | 15 | ||
25 | constructor ( | 16 | constructor ( |
@@ -36,31 +27,6 @@ export class MyAccountSettingsComponent implements OnInit, AfterViewChecked { | |||
36 | 27 | ||
37 | ngOnInit () { | 28 | ngOnInit () { |
38 | this.user = this.authService.getUser() | 29 | this.user = this.authService.getUser() |
39 | |||
40 | this.authService.userInformationLoaded.subscribe( | ||
41 | () => { | ||
42 | if (this.user.videoQuota !== -1) { | ||
43 | this.userVideoQuota = new BytesPipe().transform(this.user.videoQuota, 0).toString() | ||
44 | } else { | ||
45 | this.userVideoQuota = this.i18n('Unlimited') | ||
46 | } | ||
47 | |||
48 | if (this.user.videoQuotaDaily !== -1) { | ||
49 | this.userVideoQuotaDaily = new BytesPipe().transform(this.user.videoQuotaDaily, 0).toString() | ||
50 | } else { | ||
51 | this.userVideoQuotaDaily = this.i18n('Unlimited') | ||
52 | } | ||
53 | } | ||
54 | ) | ||
55 | |||
56 | this.userService.getMyVideoQuotaUsed() | ||
57 | .subscribe(data => { | ||
58 | this.userVideoQuotaUsed = data.videoQuotaUsed | ||
59 | this.userVideoQuotaPercentage = this.userVideoQuotaUsed * 100 / this.user.videoQuota | ||
60 | |||
61 | this.userVideoQuotaUsedDaily = data.videoQuotaUsedDaily | ||
62 | this.userVideoQuotaDailyPercentage = this.userVideoQuotaUsedDaily * 100 / this.user.videoQuotaDaily | ||
63 | }) | ||
64 | } | 30 | } |
65 | 31 | ||
66 | ngAfterViewChecked () { | 32 | ngAfterViewChecked () { |
@@ -83,8 +49,4 @@ export class MyAccountSettingsComponent implements OnInit, AfterViewChecked { | |||
83 | err => this.notifier.error(err.message) | 49 | err => this.notifier.error(err.message) |
84 | ) | 50 | ) |
85 | } | 51 | } |
86 | |||
87 | hasDailyQuota () { | ||
88 | return this.user.videoQuotaDaily !== -1 | ||
89 | } | ||
90 | } | 52 | } |