X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-main%2Faccount%2Factor-avatar-info.component.ts;h=87e9e917c6fb6db69ec0d4e997994ba6988bf863;hb=deb8b9cdb03213efd8f1fc4b40ab94ae499fe058;hp=451bbbba35c5a344cc75bea9dc6917083c0e3058;hpb=1ea7da819e5bfae7b443ed722c18c4165d101439;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/shared-main/account/actor-avatar-info.component.ts b/client/src/app/shared/shared-main/account/actor-avatar-info.component.ts index 451bbbba3..87e9e917c 100644 --- a/client/src/app/shared/shared-main/account/actor-avatar-info.component.ts +++ b/client/src/app/shared/shared-main/account/actor-avatar-info.component.ts @@ -1,10 +1,9 @@ import { Component, ElementRef, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core' import { Notifier, ServerService } from '@app/core' +import { NgbPopover } from '@ng-bootstrap/ng-bootstrap' import { getBytes } from '@root-helpers/bytes' -import { ServerConfig } from '@shared/models' -import { VideoChannel } from '../video-channel/video-channel.model' import { Account } from '../account/account.model' -import { NgbPopover } from '@ng-bootstrap/ng-bootstrap' +import { VideoChannel } from '../video-channel/video-channel.model' import { Actor } from './actor.model' @Component({ @@ -21,8 +20,11 @@ export class ActorAvatarInfoComponent implements OnInit, OnChanges { @Output() avatarChange = new EventEmitter() @Output() avatarDelete = new EventEmitter() + avatarFormat = '' + maxAvatarSize = 0 + avatarExtensions = '' + private avatarUrl: string - private serverConfig: ServerConfig constructor ( private serverService: ServerService, @@ -30,9 +32,14 @@ export class ActorAvatarInfoComponent implements OnInit, OnChanges { ) { } ngOnInit (): void { - this.serverConfig = this.serverService.getTmpConfig() this.serverService.getConfig() - .subscribe(config => this.serverConfig = config) + .subscribe(config => { + this.maxAvatarSize = config.avatar.file.size.max + this.avatarExtensions = config.avatar.file.extensions.join(', ') + + this.avatarFormat = `${$localize`max size`}: 192*192px, ` + + `${getBytes(this.maxAvatarSize)} ${$localize`extensions`}: ${this.avatarExtensions}` + }) } ngOnChanges (changes: SimpleChanges) { @@ -60,23 +67,11 @@ export class ActorAvatarInfoComponent implements OnInit, OnChanges { this.avatarDelete.emit() } - get maxAvatarSize () { - return this.serverConfig.avatar.file.size.max - } - - get maxAvatarSizeInBytes () { - return getBytes(this.maxAvatarSize) - } - - get avatarExtensions () { - return this.serverConfig.avatar.file.extensions.join(', ') - } - - get avatarFormat () { - return `${$localize`max size`}: 192*192px, ${this.maxAvatarSizeInBytes} ${$localize`extensions`}: ${this.avatarExtensions}` + hasAvatar () { + return !!this.avatarUrl } - get hasAvatar () { - return !!this.avatarUrl + isChannel () { + return !!(this.actor as VideoChannel).ownerAccount } }