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 --- client/src/app/shared/users/user.model.ts | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'client/src/app/shared/users') 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 { account: Account videoChannels: VideoChannel[] createdAt: Date - accountAvatarUrl: string constructor (hash: UserConstructorHash) { this.id = hash.id @@ -65,8 +64,12 @@ export class User implements UserServerModel { if (hash.createdAt !== undefined) { this.createdAt = hash.createdAt } + } + + get accountAvatarUrl () { + if (!this.account) return '' - this.updateComputedAttributes() + return this.account.avatarUrl } hasRight (right: UserRight) { @@ -81,17 +84,9 @@ export class User implements UserServerModel { if (obj.account !== undefined) { this.account = new Account(obj.account) } - - this.updateComputedAttributes() } updateAccountAvatar (newAccountAvatar: Avatar) { - this.account.avatar = newAccountAvatar - - this.updateComputedAttributes() - } - - private updateComputedAttributes () { - this.accountAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.account) + this.account.updateAvatar(newAccountAvatar) } } -- cgit v1.2.3