diff options
author | Chocobozzz <me@florianbigard.com> | 2018-05-25 09:57:16 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-05-25 10:41:07 +0200 |
commit | ad9e39fb815d85e5e718c40540fa75471474fa17 (patch) | |
tree | 960accb16bca0fac7694b3f3d5d038534b66c224 /client/src/app/shared/users | |
parent | 06be7ed0b27b371465c5d1b7f92b4adfb0b866ea (diff) | |
download | PeerTube-ad9e39fb815d85e5e718c40540fa75471474fa17.tar.gz PeerTube-ad9e39fb815d85e5e718c40540fa75471474fa17.tar.zst PeerTube-ad9e39fb815d85e5e718c40540fa75471474fa17.zip |
Only use account name in routes
Diffstat (limited to 'client/src/app/shared/users')
-rw-r--r-- | client/src/app/shared/users/user.model.ts | 21 |
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 @@ | |||
1 | import { Account, hasUserRight, User as UserServerModel, UserRight, UserRole, VideoChannel } from '../../../../../shared' | 1 | import { |
2 | Account as AccountServerModel, | ||
3 | hasUserRight, | ||
4 | User as UserServerModel, | ||
5 | UserRight, | ||
6 | UserRole, | ||
7 | VideoChannel | ||
8 | } from '../../../../../shared' | ||
2 | import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type' | 9 | import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type' |
3 | import { Actor } from '@app/shared/actor/actor.model' | 10 | import { Actor } from '@app/shared/actor/actor.model' |
11 | import { Account } from '@app/shared/account/account.model' | ||
4 | 12 | ||
5 | export type UserConstructorHash = { | 13 | export 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 | } |
17 | export class User implements UserServerModel { | 25 | export 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 | ||