aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+my-account
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-03-06 11:39:23 +0100
committerChocobozzz <me@florianbigard.com>2023-03-07 10:18:32 +0100
commit9e401fde36bdcb4b5e8dc54262c01f1e660d81a8 (patch)
treea2a3c115254370048c6dc0178c7ac91b977a3f2d /client/src/app/+my-account
parent464e4ed92c119c8f5d8ae561ad1d27a90d2581a0 (diff)
downloadPeerTube-9e401fde36bdcb4b5e8dc54262c01f1e660d81a8.tar.gz
PeerTube-9e401fde36bdcb4b5e8dc54262c01f1e660d81a8.tar.zst
PeerTube-9e401fde36bdcb4b5e8dc54262c01f1e660d81a8.zip
Refactor my actor avatar edit
Diffstat (limited to 'client/src/app/+my-account')
-rw-r--r--client/src/app/+my-account/my-account-settings/my-account-settings.component.ts9
1 files changed, 8 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 577f4a252..a276bb126 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
@@ -3,6 +3,7 @@ import { HttpErrorResponse } from '@angular/common/http'
3import { AfterViewChecked, Component, OnInit } from '@angular/core' 3import { AfterViewChecked, Component, OnInit } from '@angular/core'
4import { AuthService, Notifier, User, UserService } from '@app/core' 4import { AuthService, Notifier, User, UserService } from '@app/core'
5import { genericUploadErrorHandler } from '@app/helpers' 5import { genericUploadErrorHandler } from '@app/helpers'
6import { shallowCopy } from '@shared/core-utils'
6 7
7@Component({ 8@Component({
8 selector: 'my-account-settings', 9 selector: 'my-account-settings',
@@ -44,6 +45,9 @@ export class MyAccountSettingsComponent implements OnInit, AfterViewChecked {
44 this.notifier.success($localize`Avatar changed.`) 45 this.notifier.success($localize`Avatar changed.`)
45 46
46 this.user.updateAccountAvatar(data.avatars) 47 this.user.updateAccountAvatar(data.avatars)
48
49 // So my-actor-avatar component detects changes
50 this.user.account = shallowCopy(this.user.account)
47 }, 51 },
48 52
49 error: (err: HttpErrorResponse) => genericUploadErrorHandler({ 53 error: (err: HttpErrorResponse) => genericUploadErrorHandler({
@@ -57,10 +61,13 @@ export class MyAccountSettingsComponent implements OnInit, AfterViewChecked {
57 onAvatarDelete () { 61 onAvatarDelete () {
58 this.userService.deleteAvatar() 62 this.userService.deleteAvatar()
59 .subscribe({ 63 .subscribe({
60 next: data => { 64 next: () => {
61 this.notifier.success($localize`Avatar deleted.`) 65 this.notifier.success($localize`Avatar deleted.`)
62 66
63 this.user.updateAccountAvatar() 67 this.user.updateAccountAvatar()
68
69 // So my-actor-avatar component detects changes
70 this.user.account = shallowCopy(this.user.account)
64 }, 71 },
65 72
66 error: (err: HttpErrorResponse) => this.notifier.error(err.message) 73 error: (err: HttpErrorResponse) => this.notifier.error(err.message)