From 52d9f792b3fee5acce80f948295b59e3ad2073eb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 29 Jun 2018 14:34:04 +0200 Subject: Client: Add ability to update video channel avatar --- .../my-account-settings.component.ts | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) (limited to 'client/src/app/+my-account/my-account-settings/my-account-settings.component.ts') diff --git a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts index 14293f14c..164a46a48 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts @@ -13,8 +13,6 @@ import { I18n } from '@ngx-translate/i18n-polyfill' styleUrls: [ './my-account-settings.component.scss' ] }) export class MyAccountSettingsComponent implements OnInit { - @ViewChild('avatarfileInput') avatarfileInput - user: User = null userVideoQuota = '0' userVideoQuotaUsed = 0 @@ -48,16 +46,7 @@ export class MyAccountSettingsComponent implements OnInit { .subscribe(data => this.userVideoQuotaUsed = data.videoQuotaUsed) } - changeAvatar () { - const avatarfile = this.avatarfileInput.nativeElement.files[ 0 ] - if (avatarfile.size > this.maxAvatarSize) { - this.notificationsService.error('Error', 'This image is too large.') - return - } - - const formData = new FormData() - formData.append('avatarfile', avatarfile) - + onAvatarChange (formData: FormData) { this.userService.changeAvatar(formData) .subscribe( data => { @@ -69,12 +58,4 @@ export class MyAccountSettingsComponent implements OnInit { err => this.notificationsService.error(this.i18n('Error'), err.message) ) } - - get maxAvatarSize () { - return this.serverService.getConfig().avatar.file.size.max - } - - get avatarExtensions () { - return this.serverService.getConfig().avatar.file.extensions.join(',') - } } -- cgit v1.2.3