aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-29 14:34:04 +0200
committerChocobozzz <me@florianbigard.com>2018-06-29 14:34:04 +0200
commit52d9f792b3fee5acce80f948295b59e3ad2073eb (patch)
tree661f577e9c7196d199b4b49e475ecd2d88e6d7b7 /client/src/app/+my-account/my-account-settings/my-account-settings.component.ts
parent4bbfc6c606c8d3794bae25c64c516120af41f4eb (diff)
downloadPeerTube-52d9f792b3fee5acce80f948295b59e3ad2073eb.tar.gz
PeerTube-52d9f792b3fee5acce80f948295b59e3ad2073eb.tar.zst
PeerTube-52d9f792b3fee5acce80f948295b59e3ad2073eb.zip
Client: Add ability to update video channel avatar
Diffstat (limited to 'client/src/app/+my-account/my-account-settings/my-account-settings.component.ts')
-rw-r--r--client/src/app/+my-account/my-account-settings/my-account-settings.component.ts21
1 files changed, 1 insertions, 20 deletions
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'
13 styleUrls: [ './my-account-settings.component.scss' ] 13 styleUrls: [ './my-account-settings.component.scss' ]
14}) 14})
15export class MyAccountSettingsComponent implements OnInit { 15export class MyAccountSettingsComponent implements OnInit {
16 @ViewChild('avatarfileInput') avatarfileInput
17
18 user: User = null 16 user: User = null
19 userVideoQuota = '0' 17 userVideoQuota = '0'
20 userVideoQuotaUsed = 0 18 userVideoQuotaUsed = 0
@@ -48,16 +46,7 @@ export class MyAccountSettingsComponent implements OnInit {
48 .subscribe(data => this.userVideoQuotaUsed = data.videoQuotaUsed) 46 .subscribe(data => this.userVideoQuotaUsed = data.videoQuotaUsed)
49 } 47 }
50 48
51 changeAvatar () { 49 onAvatarChange (formData: FormData) {
52 const avatarfile = this.avatarfileInput.nativeElement.files[ 0 ]
53 if (avatarfile.size > this.maxAvatarSize) {
54 this.notificationsService.error('Error', 'This image is too large.')
55 return
56 }
57
58 const formData = new FormData()
59 formData.append('avatarfile', avatarfile)
60
61 this.userService.changeAvatar(formData) 50 this.userService.changeAvatar(formData)
62 .subscribe( 51 .subscribe(
63 data => { 52 data => {
@@ -69,12 +58,4 @@ export class MyAccountSettingsComponent implements OnInit {
69 err => this.notificationsService.error(this.i18n('Error'), err.message) 58 err => this.notificationsService.error(this.i18n('Error'), err.message)
70 ) 59 )
71 } 60 }
72
73 get maxAvatarSize () {
74 return this.serverService.getConfig().avatar.file.size.max
75 }
76
77 get avatarExtensions () {
78 return this.serverService.getConfig().avatar.file.extensions.join(',')
79 }
80} 61}