aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+videos/+video-edit/video-add.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+videos/+video-edit/video-add.component.ts')
-rw-r--r--client/src/app/+videos/+video-edit/video-add.component.ts38
1 files changed, 35 insertions, 3 deletions
diff --git a/client/src/app/+videos/+video-edit/video-add.component.ts b/client/src/app/+videos/+video-edit/video-add.component.ts
index a107ad123..46881be4e 100644
--- a/client/src/app/+videos/+video-edit/video-add.component.ts
+++ b/client/src/app/+videos/+video-edit/video-add.component.ts
@@ -1,6 +1,13 @@
1import { Component, HostListener, OnInit, ViewChild } from '@angular/core' 1import { Component, HostListener, OnInit, ViewChild } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router' 2import { ActivatedRoute, Router } from '@angular/router'
3import { AuthService, AuthUser, CanComponentDeactivate, HooksService, ServerService } from '@app/core' 3import {
4 AuthService,
5 AuthUser,
6 CanComponentDeactivate,
7 HooksService,
8 ServerService,
9 UserService
10} from '@app/core'
4import { HTMLServerConfig } from '@shared/models' 11import { HTMLServerConfig } from '@shared/models'
5import { VideoEditType } from './shared/video-edit.type' 12import { VideoEditType } from './shared/video-edit.type'
6import { VideoGoLiveComponent } from './video-add-components/video-go-live.component' 13import { VideoGoLiveComponent } from './video-add-components/video-go-live.component'
@@ -33,10 +40,14 @@ export class VideoAddComponent implements OnInit, CanComponentDeactivate {
33 quotaLeft: string 40 quotaLeft: string
34 } 41 }
35 42
43 hasNoQuotaLeft = false
44 hasNoQuotaLeftDaily = false
45
36 private serverConfig: HTMLServerConfig 46 private serverConfig: HTMLServerConfig
37 47
38 constructor ( 48 constructor (
39 private auth: AuthService, 49 private auth: AuthService,
50 private userService: UserService,
40 private hooks: HooksService, 51 private hooks: HooksService,
41 private serverService: ServerService, 52 private serverService: ServerService,
42 private route: ActivatedRoute, 53 private route: ActivatedRoute,
@@ -56,13 +67,34 @@ export class VideoAddComponent implements OnInit, CanComponentDeactivate {
56 67
57 this.serverConfig = this.serverService.getHTMLConfig() 68 this.serverConfig = this.serverService.getHTMLConfig()
58 69
59 this.user = this.auth.getUser()
60
61 if (this.route.snapshot.fragment) { 70 if (this.route.snapshot.fragment) {
62 this.onNavChange(this.route.snapshot.fragment) 71 this.onNavChange(this.route.snapshot.fragment)
63 } 72 }
64 73
65 this.buildUploadMessages() 74 this.buildUploadMessages()
75
76 this.userService.getMyVideoQuotaUsed()
77 .subscribe(data => {
78 // videoQuota left lower than 10%
79 if (data.videoQuotaUsed > this.user.videoQuota * 0.9) {
80 this.hasNoQuotaLeft = true
81 }
82
83 // unlimited videoQuota
84 if (this.user.videoQuota === -1) {
85 this.hasNoQuotaLeft = false
86 }
87
88 // videoQuotaDaily left lower than 10%
89 if (data.videoQuotaUsedDaily > this.user.videoQuotaDaily * 0.9) {
90 this.hasNoQuotaLeftDaily = true
91 }
92
93 // unlimited videoQuotaDaily
94 if (this.user.videoQuotaDaily === -1) {
95 this.hasNoQuotaLeftDaily = false
96 }
97 })
66 } 98 }
67 99
68 private async buildUploadMessages () { 100 private async buildUploadMessages () {