diff options
author | Chocobozzz <me@florianbigard.com> | 2018-04-25 15:43:19 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-04-25 15:43:19 +0200 |
commit | d3e91a5f72ac9c986cdb67d7d6c85bb4819e680c (patch) | |
tree | 3c2406346c7774587ba4e095ab595e5953e25c61 /client/src/app/shared/users | |
parent | 03e12d7c4954e1071fdeb7ef362ea5c3965d4075 (diff) | |
download | PeerTube-d3e91a5f72ac9c986cdb67d7d6c85bb4819e680c.tar.gz PeerTube-d3e91a5f72ac9c986cdb67d7d6c85bb4819e680c.tar.zst PeerTube-d3e91a5f72ac9c986cdb67d7d6c85bb4819e680c.zip |
Add video channel account list
Diffstat (limited to 'client/src/app/shared/users')
-rw-r--r-- | client/src/app/shared/users/user.model.ts | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts index 2bdc48a1d..d4551de89 100644 --- a/client/src/app/shared/users/user.model.ts +++ b/client/src/app/shared/users/user.model.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { hasUserRight, User as UserServerModel, UserRight, UserRole, VideoChannel } from '../../../../../shared' | 1 | import { Account, hasUserRight, User as UserServerModel, UserRight, UserRole, VideoChannel } from '../../../../../shared' |
2 | import { Account } from '../account/account.model' | ||
3 | import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type' | 2 | import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type' |
3 | import { Actor } from '@app/shared/actor/actor.model' | ||
4 | 4 | ||
5 | export type UserConstructorHash = { | 5 | export type UserConstructorHash = { |
6 | id: number, | 6 | id: number, |
@@ -25,6 +25,7 @@ export class User implements UserServerModel { | |||
25 | account: Account | 25 | account: Account |
26 | videoChannels: VideoChannel[] | 26 | videoChannels: VideoChannel[] |
27 | createdAt: Date | 27 | createdAt: Date |
28 | accountAvatarUrl: string | ||
28 | 29 | ||
29 | constructor (hash: UserConstructorHash) { | 30 | constructor (hash: UserConstructorHash) { |
30 | this.id = hash.id | 31 | this.id = hash.id |
@@ -52,19 +53,23 @@ export class User implements UserServerModel { | |||
52 | if (hash.createdAt !== undefined) { | 53 | if (hash.createdAt !== undefined) { |
53 | this.createdAt = hash.createdAt | 54 | this.createdAt = hash.createdAt |
54 | } | 55 | } |
56 | |||
57 | this.updateComputedAttributes() | ||
55 | } | 58 | } |
56 | 59 | ||
57 | hasRight (right: UserRight) { | 60 | hasRight (right: UserRight) { |
58 | return hasUserRight(this.role, right) | 61 | return hasUserRight(this.role, right) |
59 | } | 62 | } |
60 | 63 | ||
61 | getAvatarUrl () { | ||
62 | return Account.GET_ACCOUNT_AVATAR_URL(this.account) | ||
63 | } | ||
64 | |||
65 | patch (obj: UserServerModel) { | 64 | patch (obj: UserServerModel) { |
66 | for (const key of Object.keys(obj)) { | 65 | for (const key of Object.keys(obj)) { |
67 | this[key] = obj[key] | 66 | this[key] = obj[key] |
68 | } | 67 | } |
68 | |||
69 | this.updateComputedAttributes() | ||
70 | } | ||
71 | |||
72 | private updateComputedAttributes () { | ||
73 | this.accountAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.account) | ||
69 | } | 74 | } |
70 | } | 75 | } |