From c5911fd347c76e8bdc05ea9f3ee9efed4a58c236 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 29 Dec 2017 19:10:13 +0100 Subject: Begin to add avatar to actors --- client/src/app/shared/account/account.model.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'client/src/app/shared/account') diff --git a/client/src/app/shared/account/account.model.ts b/client/src/app/shared/account/account.model.ts index bacaa208a..cc46dad77 100644 --- a/client/src/app/shared/account/account.model.ts +++ b/client/src/app/shared/account/account.model.ts @@ -1,11 +1,13 @@ import { Account as ServerAccount } from '../../../../../shared/models/actors/account.model' import { Avatar } from '../../../../../shared/models/avatars/avatar.model' import { environment } from '../../../environments/environment' +import { getAbsoluteAPIUrl } from '../misc/utils' export class Account implements ServerAccount { id: number uuid: string name: string + displayName: string host: string followingCount: number followersCount: number @@ -13,9 +15,11 @@ export class Account implements ServerAccount { updatedAt: Date avatar: Avatar - static GET_ACCOUNT_AVATAR_PATH (account: Account) { - if (account && account.avatar) return account.avatar.path + static GET_ACCOUNT_AVATAR_URL (account: Account) { + const absoluteAPIUrl = getAbsoluteAPIUrl() - return '/client/assets/images/default-avatar.png' + if (account && account.avatar) return absoluteAPIUrl + account.avatar.path + + return window.location.origin + '/client/assets/images/default-avatar.png' } } -- cgit v1.2.3