aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/users
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/users')
-rw-r--r--client/src/app/shared/users/user.model.ts17
1 files changed, 6 insertions, 11 deletions
diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts
index 60a0f26df..581ea7859 100644
--- a/client/src/app/shared/users/user.model.ts
+++ b/client/src/app/shared/users/user.model.ts
@@ -34,7 +34,6 @@ export class User implements UserServerModel {
34 account: Account 34 account: Account
35 videoChannels: VideoChannel[] 35 videoChannels: VideoChannel[]
36 createdAt: Date 36 createdAt: Date
37 accountAvatarUrl: string
38 37
39 constructor (hash: UserConstructorHash) { 38 constructor (hash: UserConstructorHash) {
40 this.id = hash.id 39 this.id = hash.id
@@ -65,8 +64,12 @@ export class User implements UserServerModel {
65 if (hash.createdAt !== undefined) { 64 if (hash.createdAt !== undefined) {
66 this.createdAt = hash.createdAt 65 this.createdAt = hash.createdAt
67 } 66 }
67 }
68
69 get accountAvatarUrl () {
70 if (!this.account) return ''
68 71
69 this.updateComputedAttributes() 72 return this.account.avatarUrl
70 } 73 }
71 74
72 hasRight (right: UserRight) { 75 hasRight (right: UserRight) {
@@ -81,17 +84,9 @@ export class User implements UserServerModel {
81 if (obj.account !== undefined) { 84 if (obj.account !== undefined) {
82 this.account = new Account(obj.account) 85 this.account = new Account(obj.account)
83 } 86 }
84
85 this.updateComputedAttributes()
86 } 87 }
87 88
88 updateAccountAvatar (newAccountAvatar: Avatar) { 89 updateAccountAvatar (newAccountAvatar: Avatar) {
89 this.account.avatar = newAccountAvatar 90 this.account.updateAvatar(newAccountAvatar)
90
91 this.updateComputedAttributes()
92 }
93
94 private updateComputedAttributes () {
95 this.accountAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.account)
96 } 91 }
97} 92}