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 --- .../moderation/user-moderation-dropdown.component.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'client/src/app/shared/moderation') diff --git a/client/src/app/shared/moderation/user-moderation-dropdown.component.ts b/client/src/app/shared/moderation/user-moderation-dropdown.component.ts index e9d4c1437..d82dc3d94 100644 --- a/client/src/app/shared/moderation/user-moderation-dropdown.component.ts +++ b/client/src/app/shared/moderation/user-moderation-dropdown.component.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@angular/core' +import { Component, EventEmitter, Input, OnChanges, OnInit, Output, ViewChild } from '@angular/core' import { I18n } from '@ngx-translate/i18n-polyfill' import { DropdownAction } from '@app/shared/buttons/action-dropdown.component' import { UserBanModalComponent } from '@app/shared/moderation/user-ban-modal.component' @@ -7,12 +7,13 @@ import { AuthService, ConfirmService, Notifier, ServerService } from '@app/core' import { User, UserRight } from '../../../../../shared/models/users' import { Account } from '@app/shared/account/account.model' import { BlocklistService } from '@app/shared/blocklist' +import { ServerConfig } from '@shared/models' @Component({ selector: 'my-user-moderation-dropdown', templateUrl: './user-moderation-dropdown.component.html' }) -export class UserModerationDropdownComponent implements OnChanges { +export class UserModerationDropdownComponent implements OnInit, OnChanges { @ViewChild('userBanModal', { static: false }) userBanModal: UserBanModalComponent @Input() user: User @@ -26,6 +27,8 @@ export class UserModerationDropdownComponent implements OnChanges { userActions: DropdownAction<{ user: User, account: Account }>[][] = [] + private serverConfig: ServerConfig + constructor ( private authService: AuthService, private notifier: Notifier, @@ -38,7 +41,13 @@ export class UserModerationDropdownComponent implements OnChanges { ) { } get requiresEmailVerification () { - return this.serverService.getConfig().signup.requiresEmailVerification + return this.serverConfig.signup.requiresEmailVerification + } + + ngOnInit (): void { + this.serverConfig = this.serverService.getTmpConfig() + this.serverService.getConfig() + .subscribe(config => this.serverConfig = config) } ngOnChanges () { -- cgit v1.2.3