diff options
Diffstat (limited to 'client/src/app/shared/users')
-rw-r--r-- | client/src/app/shared/users/user.model.ts | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts index b075ab717..83990d8b8 100644 --- a/client/src/app/shared/users/user.model.ts +++ b/client/src/app/shared/users/user.model.ts | |||
@@ -1,10 +1,5 @@ | |||
1 | import { | 1 | import { hasUserRight, User as UserServerModel, UserRight, UserRole, VideoChannel } from '../../../../../shared' |
2 | User as UserServerModel, | 2 | import { Account } from '../../../../../shared/models/accounts' |
3 | UserRole, | ||
4 | VideoChannel, | ||
5 | UserRight, | ||
6 | hasUserRight | ||
7 | } from '../../../../../shared' | ||
8 | 3 | ||
9 | export type UserConstructorHash = { | 4 | export type UserConstructorHash = { |
10 | id: number, | 5 | id: number, |
@@ -14,10 +9,7 @@ export type UserConstructorHash = { | |||
14 | videoQuota?: number, | 9 | videoQuota?: number, |
15 | displayNSFW?: boolean, | 10 | displayNSFW?: boolean, |
16 | createdAt?: Date, | 11 | createdAt?: Date, |
17 | account?: { | 12 | account?: Account, |
18 | id: number | ||
19 | uuid: string | ||
20 | }, | ||
21 | videoChannels?: VideoChannel[] | 13 | videoChannels?: VideoChannel[] |
22 | } | 14 | } |
23 | export class User implements UserServerModel { | 15 | export class User implements UserServerModel { |
@@ -27,10 +19,7 @@ export class User implements UserServerModel { | |||
27 | role: UserRole | 19 | role: UserRole |
28 | displayNSFW: boolean | 20 | displayNSFW: boolean |
29 | videoQuota: number | 21 | videoQuota: number |
30 | account: { | 22 | account: Account |
31 | id: number | ||
32 | uuid: string | ||
33 | } | ||
34 | videoChannels: VideoChannel[] | 23 | videoChannels: VideoChannel[] |
35 | createdAt: Date | 24 | createdAt: Date |
36 | 25 | ||
@@ -61,4 +50,10 @@ export class User implements UserServerModel { | |||
61 | hasRight (right: UserRight) { | 50 | hasRight (right: UserRight) { |
62 | return hasUserRight(this.role, right) | 51 | return hasUserRight(this.role, right) |
63 | } | 52 | } |
53 | |||
54 | getAvatarPath () { | ||
55 | if (this.account && this.account.avatar) return this.account.avatar.path | ||
56 | |||
57 | return '/assets/default-avatar.png' | ||
58 | } | ||
64 | } | 59 | } |