From 590124f66865e7d55db1d28c0f443bb62ab2c0fe Mon Sep 17 00:00:00 2001 From: Andrey Platov Date: Fri, 10 Sep 2021 17:54:13 +0200 Subject: [PATCH] accounts update Signed-off-by: Andrey Platov --- packages/core/src/utils.ts | 18 ++++++++++++++++- .../src/components/Backlink.svelte | 20 +++++++++++++++++-- .../src/components/WorkbenchApp.svelte | 2 +- plugins/workbench-resources/src/utils.ts | 8 -------- 4 files changed, 36 insertions(+), 12 deletions(-) diff --git a/packages/core/src/utils.ts b/packages/core/src/utils.ts index 46a511992b..eb6b3825eb 100644 --- a/packages/core/src/utils.ts +++ b/packages/core/src/utils.ts @@ -13,7 +13,7 @@ // limitations under the License. // -import type { Doc, Ref } from './classes' +import type { Doc, Ref, Account } from './classes' function toHex (value: number, chars: number): string { const result = value.toString(16) @@ -43,3 +43,19 @@ function count (): string { export function generateId (): Ref { return (timestamp() + random + count()) as Ref } + +let currentAccount: Account + +/** + * @public + * @returns + */ +export function getCurrentAccount (): Account { return currentAccount } + +/** + * @public + * @param account - + */ +export function setCurrentAccount (account: Account): void { + currentAccount = account +} diff --git a/plugins/chunter-resources/src/components/Backlink.svelte b/plugins/chunter-resources/src/components/Backlink.svelte index 37d0a9306e..5c68701faf 100644 --- a/plugins/chunter-resources/src/components/Backlink.svelte +++ b/plugins/chunter-resources/src/components/Backlink.svelte @@ -15,18 +15,34 @@
-
Rosamund ChenJuly 28th
+
{#if employee}{employee.firstName} {employee.lastName}{/if}July 28th
diff --git a/plugins/workbench-resources/src/components/WorkbenchApp.svelte b/plugins/workbench-resources/src/components/WorkbenchApp.svelte index 6a66c35b6f..eb8f7b6a0c 100644 --- a/plugins/workbench-resources/src/components/WorkbenchApp.svelte +++ b/plugins/workbench-resources/src/components/WorkbenchApp.svelte @@ -17,6 +17,7 @@ import { getResource } from '@anticrm/platform' import type { Client } from '@anticrm/core' +import { setCurrentAccount } from '@anticrm/core' import { navigate, Loading, fetchMetadataLocalStorage } from '@anticrm/ui' import client from '@anticrm/client' @@ -24,7 +25,6 @@ import login from '@anticrm/login' import contact from '@anticrm/contact' import Workbench from './Workbench.svelte' -import { setCurrentAccount } from '../utils' async function connect(): Promise { const token = fetchMetadataLocalStorage(login.metadata.LoginToken) diff --git a/plugins/workbench-resources/src/utils.ts b/plugins/workbench-resources/src/utils.ts index c362a4d2a4..8f898533fe 100644 --- a/plugins/workbench-resources/src/utils.ts +++ b/plugins/workbench-resources/src/utils.ts @@ -22,11 +22,3 @@ import type { EmployeeAccount } from '@anticrm/contact' export function classIcon(client: Client, _class: Ref>): Asset | undefined { return client.getHierarchy().getClass(_class).icon } - -let currentAccount: EmployeeAccount - -export function getCurrentAccount(): EmployeeAccount { return currentAccount } - -export function setCurrentAccount(account: EmployeeAccount): void { - currentAccount = account -}