aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+my-account/shared
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/+my-account/shared
parent5dfb7c1dec8222b0bbccac5b56ad46da1438747e (diff)
downloadPeerTube-ba430d7516bc5b1324b60571ba7594460969b7fb.tar.gz
PeerTube-ba430d7516bc5b1324b60571ba7594460969b7fb.tar.zst
PeerTube-ba430d7516bc5b1324b60571ba7594460969b7fb.zip
Lazy load static objects
Diffstat (limited to 'client/src/app/+my-account/shared')
-rw-r--r--client/src/app/+my-account/shared/actor-avatar-info.component.ts17
1 files changed, 13 insertions, 4 deletions
diff --git a/client/src/app/+my-account/shared/actor-avatar-info.component.ts b/client/src/app/+my-account/shared/actor-avatar-info.component.ts
index 0289a66c3..101dfa556 100644
--- a/client/src/app/+my-account/shared/actor-avatar-info.component.ts
+++ b/client/src/app/+my-account/shared/actor-avatar-info.component.ts
@@ -1,26 +1,35 @@
1import { Component, ElementRef, EventEmitter, Input, Output, ViewChild } from '@angular/core' 1import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'
2import { ServerService } from '../../core/server' 2import { ServerService } from '../../core/server'
3import { VideoChannel } from '@app/shared/video-channel/video-channel.model' 3import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
4import { Account } from '@app/shared/account/account.model' 4import { Account } from '@app/shared/account/account.model'
5import { Notifier } from '@app/core' 5import { Notifier } from '@app/core'
6import { ServerConfig } from '@shared/models'
6 7
7@Component({ 8@Component({
8 selector: 'my-actor-avatar-info', 9 selector: 'my-actor-avatar-info',
9 templateUrl: './actor-avatar-info.component.html', 10 templateUrl: './actor-avatar-info.component.html',
10 styleUrls: [ './actor-avatar-info.component.scss' ] 11 styleUrls: [ './actor-avatar-info.component.scss' ]
11}) 12})
12export class ActorAvatarInfoComponent { 13export class ActorAvatarInfoComponent implements OnInit {
13 @ViewChild('avatarfileInput', { static: false }) avatarfileInput: ElementRef<HTMLInputElement> 14 @ViewChild('avatarfileInput', { static: false }) avatarfileInput: ElementRef<HTMLInputElement>
14 15
15 @Input() actor: VideoChannel | Account 16 @Input() actor: VideoChannel | Account
16 17
17 @Output() avatarChange = new EventEmitter<FormData>() 18 @Output() avatarChange = new EventEmitter<FormData>()
18 19
20 private serverConfig: ServerConfig
21
19 constructor ( 22 constructor (
20 private serverService: ServerService, 23 private serverService: ServerService,
21 private notifier: Notifier 24 private notifier: Notifier
22 ) {} 25 ) {}
23 26
27 ngOnInit (): void {
28 this.serverConfig = this.serverService.getTmpConfig()
29 this.serverService.getConfig()
30 .subscribe(config => this.serverConfig = config)
31 }
32
24 onAvatarChange () { 33 onAvatarChange () {
25 const avatarfile = this.avatarfileInput.nativeElement.files[ 0 ] 34 const avatarfile = this.avatarfileInput.nativeElement.files[ 0 ]
26 if (avatarfile.size > this.maxAvatarSize) { 35 if (avatarfile.size > this.maxAvatarSize) {
@@ -35,10 +44,10 @@ export class ActorAvatarInfoComponent {
35 } 44 }
36 45
37 get maxAvatarSize () { 46 get maxAvatarSize () {
38 return this.serverService.getConfig().avatar.file.size.max 47 return this.serverConfig.avatar.file.size.max
39 } 48 }
40 49
41 get avatarExtensions () { 50 get avatarExtensions () {
42 return this.serverService.getConfig().avatar.file.extensions.join(',') 51 return this.serverConfig.avatar.file.extensions.join(',')
43 } 52 }
44} 53}