diff options
author | Chocobozzz <me@florianbigard.com> | 2018-06-22 15:42:55 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-22 15:42:55 +0200 |
commit | 0c237b19fdf9c614293c1442f0ab95a81ce05735 (patch) | |
tree | 81f7ae4262630da5e8041bd70e2cb856e48253a3 /client/src/app/+my-account | |
parent | c4082b8b4e3684baae0172e97297c936d7419f2c (diff) | |
download | PeerTube-0c237b19fdf9c614293c1442f0ab95a81ce05735.tar.gz PeerTube-0c237b19fdf9c614293c1442f0ab95a81ce05735.tar.zst PeerTube-0c237b19fdf9c614293c1442f0ab95a81ce05735.zip |
Fix images size limit
Diffstat (limited to 'client/src/app/+my-account')
-rw-r--r-- | client/src/app/+my-account/my-account-settings/my-account-settings.component.ts | 6 |
1 files changed, 5 insertions, 1 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 15f977e58..14293f14c 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 | |||
@@ -50,6 +50,10 @@ export class MyAccountSettingsComponent implements OnInit { | |||
50 | 50 | ||
51 | changeAvatar () { | 51 | changeAvatar () { |
52 | const avatarfile = this.avatarfileInput.nativeElement.files[ 0 ] | 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 | } | ||
53 | 57 | ||
54 | const formData = new FormData() | 58 | const formData = new FormData() |
55 | formData.append('avatarfile', avatarfile) | 59 | formData.append('avatarfile', avatarfile) |
@@ -59,7 +63,7 @@ export class MyAccountSettingsComponent implements OnInit { | |||
59 | data => { | 63 | data => { |
60 | this.notificationsService.success(this.i18n('Success'), this.i18n('Avatar changed.')) | 64 | this.notificationsService.success(this.i18n('Success'), this.i18n('Avatar changed.')) |
61 | 65 | ||
62 | this.user.account.avatar = data.avatar | 66 | this.user.updateAccountAvatar(data.avatar) |
63 | }, | 67 | }, |
64 | 68 | ||
65 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 69 | err => this.notificationsService.error(this.i18n('Error'), err.message) |