From ad9e39fb815d85e5e718c40540fa75471474fa17 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 25 May 2018 09:57:16 +0200 Subject: Only use account name in routes --- client/src/app/shared/users/user.model.ts | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'client/src/app/shared/users/user.model.ts') 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 @@ -import { Account, hasUserRight, User as UserServerModel, UserRight, UserRole, VideoChannel } from '../../../../../shared' +import { + Account as AccountServerModel, + hasUserRight, + User as UserServerModel, + UserRight, + UserRole, + VideoChannel +} from '../../../../../shared' import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type' import { Actor } from '@app/shared/actor/actor.model' +import { Account } from '@app/shared/account/account.model' export type UserConstructorHash = { id: number, @@ -11,7 +19,7 @@ export type UserConstructorHash = { nsfwPolicy?: NSFWPolicyType, autoPlayVideo?: boolean, createdAt?: Date, - account?: Account, + account?: AccountServerModel, videoChannels?: VideoChannel[] } export class User implements UserServerModel { @@ -32,7 +40,10 @@ export class User implements UserServerModel { this.username = hash.username this.email = hash.email this.role = hash.role - this.account = hash.account + + if (hash.account !== undefined) { + this.account = new Account(hash.account) + } if (hash.videoChannels !== undefined) { this.videoChannels = hash.videoChannels @@ -66,6 +77,10 @@ export class User implements UserServerModel { this[key] = obj[key] } + if (obj.account !== undefined) { + this.account = new Account(obj.account) + } + this.updateComputedAttributes() } -- cgit v1.2.3