From 76d36e0b355f41fb46709ba5e39c59b10087c6a9 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 8 Jan 2018 10:35:54 +0100 Subject: Refractor account by --- client/src/app/shared/account/account.model.ts | 9 +++++++++ 1 file changed, 9 insertions(+) (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 1dce0003c..dffca783b 100644 --- a/client/src/app/shared/account/account.model.ts +++ b/client/src/app/shared/account/account.model.ts @@ -22,4 +22,13 @@ export class Account implements ServerAccount { return window.location.origin + '/client/assets/images/default-avatar.png' } + + static CREATE_BY_STRING (accountName: string, host: string) { + const absoluteAPIUrl = getAbsoluteAPIUrl() + const thisHost = new URL(absoluteAPIUrl).host + + if (host.trim() === thisHost) return accountName + + return accountName + '@' + host + } } -- cgit v1.2.3