From ba430d7516bc5b1324b60571ba7594460969b7fb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 18 Dec 2019 15:31:54 +0100 Subject: Lazy load static objects --- .../+my-account/shared/actor-avatar-info.component.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'client/src/app/+my-account/shared') 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 @@ -import { Component, ElementRef, EventEmitter, Input, Output, ViewChild } from '@angular/core' +import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' import { ServerService } from '../../core/server' import { VideoChannel } from '@app/shared/video-channel/video-channel.model' import { Account } from '@app/shared/account/account.model' import { Notifier } from '@app/core' +import { ServerConfig } from '@shared/models' @Component({ selector: 'my-actor-avatar-info', templateUrl: './actor-avatar-info.component.html', styleUrls: [ './actor-avatar-info.component.scss' ] }) -export class ActorAvatarInfoComponent { +export class ActorAvatarInfoComponent implements OnInit { @ViewChild('avatarfileInput', { static: false }) avatarfileInput: ElementRef @Input() actor: VideoChannel | Account @Output() avatarChange = new EventEmitter() + private serverConfig: ServerConfig + constructor ( private serverService: ServerService, private notifier: Notifier ) {} + ngOnInit (): void { + this.serverConfig = this.serverService.getTmpConfig() + this.serverService.getConfig() + .subscribe(config => this.serverConfig = config) + } + onAvatarChange () { const avatarfile = this.avatarfileInput.nativeElement.files[ 0 ] if (avatarfile.size > this.maxAvatarSize) { @@ -35,10 +44,10 @@ export class ActorAvatarInfoComponent { } get maxAvatarSize () { - return this.serverService.getConfig().avatar.file.size.max + return this.serverConfig.avatar.file.size.max } get avatarExtensions () { - return this.serverService.getConfig().avatar.file.extensions.join(',') + return this.serverConfig.avatar.file.extensions.join(',') } } -- cgit v1.2.3