aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/users
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/shared/users
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/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}