]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/+my-account/my-account-settings/my-account-settings.component.ts
Display user quota progress bars above upload form (#2981)
[github/Chocobozzz/PeerTube.git] / client / src / app / +my-account / my-account-settings / my-account-settings.component.ts
index a9a150e210c86a147afc171befa854a1a04c2eae..a3a8ff1f19020555159b8671cdd493e32123f8a1 100644 (file)
@@ -1,4 +1,3 @@
-import { BytesPipe } from 'ngx-pipes'
 import { ViewportScroller } from '@angular/common'
 import { AfterViewChecked, Component, OnInit } from '@angular/core'
 import { AuthService, Notifier, User, UserService } from '@app/core'
@@ -12,14 +11,6 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
 export class MyAccountSettingsComponent implements OnInit, AfterViewChecked {
   user: User = null
 
-  userVideoQuota = '0'
-  userVideoQuotaUsed = 0
-  userVideoQuotaPercentage = 15
-
-  userVideoQuotaDaily = '0'
-  userVideoQuotaUsedDaily = 0
-  userVideoQuotaDailyPercentage = 15
-
   private lastScrollHash: string
 
   constructor (
@@ -36,31 +27,6 @@ export class MyAccountSettingsComponent implements OnInit, AfterViewChecked {
 
   ngOnInit () {
     this.user = this.authService.getUser()
-
-    this.authService.userInformationLoaded.subscribe(
-      () => {
-        if (this.user.videoQuota !== -1) {
-          this.userVideoQuota = new BytesPipe().transform(this.user.videoQuota, 0).toString()
-        } else {
-          this.userVideoQuota = this.i18n('Unlimited')
-        }
-
-        if (this.user.videoQuotaDaily !== -1) {
-          this.userVideoQuotaDaily = new BytesPipe().transform(this.user.videoQuotaDaily, 0).toString()
-        } else {
-          this.userVideoQuotaDaily = this.i18n('Unlimited')
-        }
-      }
-    )
-
-    this.userService.getMyVideoQuotaUsed()
-      .subscribe(data => {
-        this.userVideoQuotaUsed = data.videoQuotaUsed
-        this.userVideoQuotaPercentage = this.userVideoQuotaUsed * 100 / this.user.videoQuota
-
-        this.userVideoQuotaUsedDaily = data.videoQuotaUsedDaily
-        this.userVideoQuotaDailyPercentage = this.userVideoQuotaUsedDaily * 100 / this.user.videoQuotaDaily
-      })
   }
 
   ngAfterViewChecked () {
@@ -83,8 +49,4 @@ export class MyAccountSettingsComponent implements OnInit, AfterViewChecked {
         err => this.notifier.error(err.message)
       )
   }
-
-  hasDailyQuota () {
-    return this.user.videoQuotaDaily !== -1
-  }
 }