diff options
author | Chocobozzz <me@florianbigard.com> | 2019-02-11 11:52:34 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-02-11 11:52:34 +0100 |
commit | 88108880bbdba473cfe36ecbebc1c3c4f972e102 (patch) | |
tree | b242efb3b4f0d7e49d88f2d1f2063b5b3b0489c0 /client/src/app/shared/users/user.model.ts | |
parent | 53a94c7cfa8368da4cd248d65df8346905938f0c (diff) | |
parent | 9b712a2017e4ab3cf12cd6bd58278905520159d0 (diff) | |
download | PeerTube-88108880bbdba473cfe36ecbebc1c3c4f972e102.tar.gz PeerTube-88108880bbdba473cfe36ecbebc1c3c4f972e102.tar.zst PeerTube-88108880bbdba473cfe36ecbebc1c3c4f972e102.zip |
Merge branch 'develop' into pr/1217
Diffstat (limited to 'client/src/app/shared/users/user.model.ts')
-rw-r--r-- | client/src/app/shared/users/user.model.ts | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts index 877f1bf3a..c15f1de8c 100644 --- a/client/src/app/shared/users/user.model.ts +++ b/client/src/app/shared/users/user.model.ts | |||
@@ -1,38 +1,20 @@ | |||
1 | import { | 1 | import { hasUserRight, User as UserServerModel, UserNotificationSetting, UserRight, UserRole, VideoChannel } from '../../../../../shared' |
2 | Account as AccountServerModel, | ||
3 | hasUserRight, | ||
4 | User as UserServerModel, | ||
5 | UserRight, | ||
6 | UserRole, | ||
7 | VideoChannel | ||
8 | } from '../../../../../shared' | ||
9 | import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type' | 2 | import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type' |
10 | import { Account } from '@app/shared/account/account.model' | 3 | import { Account } from '@app/shared/account/account.model' |
11 | import { Avatar } from '../../../../../shared/models/avatars/avatar.model' | 4 | import { Avatar } from '../../../../../shared/models/avatars/avatar.model' |
12 | 5 | ||
13 | export type UserConstructorHash = { | ||
14 | id: number, | ||
15 | username: string, | ||
16 | email: string, | ||
17 | role: UserRole, | ||
18 | videoQuota?: number, | ||
19 | videoQuotaDaily?: number, | ||
20 | nsfwPolicy?: NSFWPolicyType, | ||
21 | autoPlayVideo?: boolean, | ||
22 | createdAt?: Date, | ||
23 | account?: AccountServerModel, | ||
24 | videoChannels?: VideoChannel[] | ||
25 | |||
26 | blocked?: boolean | ||
27 | blockedReason?: string | ||
28 | } | ||
29 | export class User implements UserServerModel { | 6 | export class User implements UserServerModel { |
30 | id: number | 7 | id: number |
31 | username: string | 8 | username: string |
32 | email: string | 9 | email: string |
10 | emailVerified: boolean | ||
33 | role: UserRole | 11 | role: UserRole |
34 | nsfwPolicy: NSFWPolicyType | 12 | nsfwPolicy: NSFWPolicyType |
13 | |||
14 | webTorrentEnabled: boolean | ||
35 | autoPlayVideo: boolean | 15 | autoPlayVideo: boolean |
16 | videosHistoryEnabled: boolean | ||
17 | |||
36 | videoQuota: number | 18 | videoQuota: number |
37 | videoQuotaDaily: number | 19 | videoQuotaDaily: number |
38 | account: Account | 20 | account: Account |
@@ -42,7 +24,9 @@ export class User implements UserServerModel { | |||
42 | blocked: boolean | 24 | blocked: boolean |
43 | blockedReason?: string | 25 | blockedReason?: string |
44 | 26 | ||
45 | constructor (hash: UserConstructorHash) { | 27 | notificationSettings?: UserNotificationSetting |
28 | |||
29 | constructor (hash: Partial<UserServerModel>) { | ||
46 | this.id = hash.id | 30 | this.id = hash.id |
47 | this.username = hash.username | 31 | this.username = hash.username |
48 | this.email = hash.email | 32 | this.email = hash.email |
@@ -52,11 +36,15 @@ export class User implements UserServerModel { | |||
52 | this.videoQuota = hash.videoQuota | 36 | this.videoQuota = hash.videoQuota |
53 | this.videoQuotaDaily = hash.videoQuotaDaily | 37 | this.videoQuotaDaily = hash.videoQuotaDaily |
54 | this.nsfwPolicy = hash.nsfwPolicy | 38 | this.nsfwPolicy = hash.nsfwPolicy |
39 | this.webTorrentEnabled = hash.webTorrentEnabled | ||
40 | this.videosHistoryEnabled = hash.videosHistoryEnabled | ||
55 | this.autoPlayVideo = hash.autoPlayVideo | 41 | this.autoPlayVideo = hash.autoPlayVideo |
56 | this.createdAt = hash.createdAt | 42 | this.createdAt = hash.createdAt |
57 | this.blocked = hash.blocked | 43 | this.blocked = hash.blocked |
58 | this.blockedReason = hash.blockedReason | 44 | this.blockedReason = hash.blockedReason |
59 | 45 | ||
46 | this.notificationSettings = hash.notificationSettings | ||
47 | |||
60 | if (hash.account !== undefined) { | 48 | if (hash.account !== undefined) { |
61 | this.account = new Account(hash.account) | 49 | this.account = new Account(hash.account) |
62 | } | 50 | } |