aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/instance/instance-features-table.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-12-18 15:31:54 +0100
committerChocobozzz <me@florianbigard.com>2019-12-18 15:40:59 +0100
commitba430d7516bc5b1324b60571ba7594460969b7fb (patch)
treedf5c6952c82f49a94c0a884bbc97d4a0cbd9f867 /client/src/app/shared/instance/instance-features-table.component.ts
parent5dfb7c1dec8222b0bbccac5b56ad46da1438747e (diff)
downloadPeerTube-ba430d7516bc5b1324b60571ba7594460969b7fb.tar.gz
PeerTube-ba430d7516bc5b1324b60571ba7594460969b7fb.tar.zst
PeerTube-ba430d7516bc5b1324b60571ba7594460969b7fb.zip
Lazy load static objects
Diffstat (limited to 'client/src/app/shared/instance/instance-features-table.component.ts')
-rw-r--r--client/src/app/shared/instance/instance-features-table.component.ts23
1 files changed, 12 insertions, 11 deletions
diff --git a/client/src/app/shared/instance/instance-features-table.component.ts b/client/src/app/shared/instance/instance-features-table.component.ts
index 1661f1efe..8fd15ebad 100644
--- a/client/src/app/shared/instance/instance-features-table.component.ts
+++ b/client/src/app/shared/instance/instance-features-table.component.ts
@@ -10,7 +10,7 @@ import { ServerConfig } from '@shared/models'
10}) 10})
11export class InstanceFeaturesTableComponent implements OnInit { 11export class InstanceFeaturesTableComponent implements OnInit {
12 quotaHelpIndication = '' 12 quotaHelpIndication = ''
13 config: ServerConfig 13 serverConfig: ServerConfig
14 14
15 constructor ( 15 constructor (
16 private i18n: I18n, 16 private i18n: I18n,
@@ -19,29 +19,34 @@ export class InstanceFeaturesTableComponent implements OnInit {
19 } 19 }
20 20
21 get initialUserVideoQuota () { 21 get initialUserVideoQuota () {
22 return this.serverService.getConfig().user.videoQuota 22 return this.serverConfig.user.videoQuota
23 } 23 }
24 24
25 get dailyUserVideoQuota () { 25 get dailyUserVideoQuota () {
26 return Math.min(this.initialUserVideoQuota, this.serverService.getConfig().user.videoQuotaDaily) 26 return Math.min(this.initialUserVideoQuota, this.serverConfig.user.videoQuotaDaily)
27 } 27 }
28 28
29 ngOnInit () { 29 ngOnInit () {
30 this.serverService.configLoaded 30 this.serverConfig = this.serverService.getTmpConfig()
31 .subscribe(() => { 31 this.serverService.getConfig()
32 this.config = this.serverService.getConfig() 32 .subscribe(config => {
33 this.serverConfig = config
33 this.buildQuotaHelpIndication() 34 this.buildQuotaHelpIndication()
34 }) 35 })
35 } 36 }
36 37
37 buildNSFWLabel () { 38 buildNSFWLabel () {
38 const policy = this.serverService.getConfig().instance.defaultNSFWPolicy 39 const policy = this.serverConfig.instance.defaultNSFWPolicy
39 40
40 if (policy === 'do_not_list') return this.i18n('Hidden') 41 if (policy === 'do_not_list') return this.i18n('Hidden')
41 if (policy === 'blur') return this.i18n('Blurred with confirmation request') 42 if (policy === 'blur') return this.i18n('Blurred with confirmation request')
42 if (policy === 'display') return this.i18n('Displayed') 43 if (policy === 'display') return this.i18n('Displayed')
43 } 44 }
44 45
46 getServerVersionAndCommit () {
47 return this.serverService.getServerVersionAndCommit()
48 }
49
45 private getApproximateTime (seconds: number) { 50 private getApproximateTime (seconds: number) {
46 const hours = Math.floor(seconds / 3600) 51 const hours = Math.floor(seconds / 3600)
47 let pluralSuffix = '' 52 let pluralSuffix = ''
@@ -53,10 +58,6 @@ export class InstanceFeaturesTableComponent implements OnInit {
53 return this.i18n('~ {{minutes}} {minutes, plural, =1 {minute} other {minutes}}', { minutes }) 58 return this.i18n('~ {{minutes}} {minutes, plural, =1 {minute} other {minutes}}', { minutes })
54 } 59 }
55 60
56 getServerVersionAndCommit () {
57 return this.serverService.getServerVersionAndCommit()
58 }
59
60 private buildQuotaHelpIndication () { 61 private buildQuotaHelpIndication () {
61 if (this.initialUserVideoQuota === -1) return 62 if (this.initialUserVideoQuota === -1) return
62 63