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.ts21
1 files changed, 18 insertions, 3 deletions
diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts
index d4551de89..b4be2270f 100644
--- a/client/src/app/shared/users/user.model.ts
+++ b/client/src/app/shared/users/user.model.ts
@@ -1,6 +1,14 @@
1import { Account, hasUserRight, User as UserServerModel, UserRight, UserRole, VideoChannel } from '../../../../../shared' 1import {
2 Account as AccountServerModel,
3 hasUserRight,
4 User as UserServerModel,
5 UserRight,
6 UserRole,
7 VideoChannel
8} from '../../../../../shared'
2import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type' 9import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type'
3import { Actor } from '@app/shared/actor/actor.model' 10import { Actor } from '@app/shared/actor/actor.model'
11import { Account } from '@app/shared/account/account.model'
4 12
5export type UserConstructorHash = { 13export type UserConstructorHash = {
6 id: number, 14 id: number,
@@ -11,7 +19,7 @@ export type UserConstructorHash = {
11 nsfwPolicy?: NSFWPolicyType, 19 nsfwPolicy?: NSFWPolicyType,
12 autoPlayVideo?: boolean, 20 autoPlayVideo?: boolean,
13 createdAt?: Date, 21 createdAt?: Date,
14 account?: Account, 22 account?: AccountServerModel,
15 videoChannels?: VideoChannel[] 23 videoChannels?: VideoChannel[]
16} 24}
17export class User implements UserServerModel { 25export class User implements UserServerModel {
@@ -32,7 +40,10 @@ export class User implements UserServerModel {
32 this.username = hash.username 40 this.username = hash.username
33 this.email = hash.email 41 this.email = hash.email
34 this.role = hash.role 42 this.role = hash.role
35 this.account = hash.account 43
44 if (hash.account !== undefined) {
45 this.account = new Account(hash.account)
46 }
36 47
37 if (hash.videoChannels !== undefined) { 48 if (hash.videoChannels !== undefined) {
38 this.videoChannels = hash.videoChannels 49 this.videoChannels = hash.videoChannels
@@ -66,6 +77,10 @@ export class User implements UserServerModel {
66 this[key] = obj[key] 77 this[key] = obj[key]
67 } 78 }
68 79
80 if (obj.account !== undefined) {
81 this.account = new Account(obj.account)
82 }
83
69 this.updateComputedAttributes() 84 this.updateComputedAttributes()
70 } 85 }
71 86