From 0231234f9a892975907e4d28bd2e573f893cd43c Mon Sep 17 00:00:00 2001 From: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com> Date: Mon, 16 May 2022 11:02:40 +0600 Subject: [PATCH] Employee status requests flood fix (#1759) --- .../src/components/Channel.svelte | 5 +- .../src/components/SavedMessages.svelte | 5 +- .../src/components/ThreadView.svelte | 5 +- plugins/contact-assets/lang/en.json | 3 +- plugins/contact-assets/lang/ru.json | 3 +- .../src/components/EmployeePresenter.svelte | 14 +++-- .../components/EmployeePreviewPopup.svelte | 63 ++++++++++--------- .../components/EmployeeStatusPresenter.svelte | 25 +++----- plugins/contact-resources/src/plugin.ts | 3 +- 9 files changed, 69 insertions(+), 57 deletions(-) diff --git a/plugins/chunter-resources/src/components/Channel.svelte b/plugins/chunter-resources/src/components/Channel.svelte index 378bef7f09..3d6f19cb95 100644 --- a/plugins/chunter-resources/src/components/Channel.svelte +++ b/plugins/chunter-resources/src/components/Channel.svelte @@ -60,7 +60,10 @@ res.map((r) => { return [r._id, r] }) - )) + )), + { + lookup: { _id: { statuses: contact.class.Status } } + } ) $: updateQuery(space) diff --git a/plugins/chunter-resources/src/components/SavedMessages.svelte b/plugins/chunter-resources/src/components/SavedMessages.svelte index bc98054d0b..043acb9956 100644 --- a/plugins/chunter-resources/src/components/SavedMessages.svelte +++ b/plugins/chunter-resources/src/components/SavedMessages.svelte @@ -70,7 +70,10 @@ res.map((r) => { return [r._id, r] }) - )) + )), + { + lookup: { _id: { statuses: contact.class.Status } } + } ) const pinnedQuery = createQuery() diff --git a/plugins/chunter-resources/src/components/ThreadView.svelte b/plugins/chunter-resources/src/components/ThreadView.svelte index 7352ca9b37..c978c7f08c 100644 --- a/plugins/chunter-resources/src/components/ThreadView.svelte +++ b/plugins/chunter-resources/src/components/ThreadView.svelte @@ -124,7 +124,10 @@ res.map((r) => { return [r._id, r] }) - )) + )), + { + lookup: { _id: { statuses: contact.class.Status } } + } ) const savedMessagesQuery = createQuery() diff --git a/plugins/contact-assets/lang/en.json b/plugins/contact-assets/lang/en.json index 206e2403ac..1412b3b93d 100644 --- a/plugins/contact-assets/lang/en.json +++ b/plugins/contact-assets/lang/en.json @@ -56,6 +56,7 @@ "TypeLabel": "Type", "StatusDueDateTooltip": "Until {date}", "CopyToClipboard": "Copy to clipboard", - "Copied": "Copied" + "Copied": "Copied", + "ViewFullProfile": "View full profile" } } \ No newline at end of file diff --git a/plugins/contact-assets/lang/ru.json b/plugins/contact-assets/lang/ru.json index 1b01ddbfdc..f067adaf57 100644 --- a/plugins/contact-assets/lang/ru.json +++ b/plugins/contact-assets/lang/ru.json @@ -56,6 +56,7 @@ "TypeLabel": "Тип", "StatusDueDateTooltip": "До {date}", "CopyToClipboard": "Скопировать в буфер обмена", - "Copied": "Скопировано" + "Copied": "Скопировано", + "ViewFullProfile": "Посмотреть профиль" } } \ No newline at end of file diff --git a/plugins/contact-resources/src/components/EmployeePresenter.svelte b/plugins/contact-resources/src/components/EmployeePresenter.svelte index 22805059b9..16852001ce 100644 --- a/plugins/contact-resources/src/components/EmployeePresenter.svelte +++ b/plugins/contact-resources/src/components/EmployeePresenter.svelte @@ -4,8 +4,9 @@ import PersonPresenter from '../components/PersonPresenter.svelte' import { showPopup } from '@anticrm/ui' import EmployeePreviewPopup from './EmployeePreviewPopup.svelte' + import { WithLookup } from '@anticrm/core' - export let value: Employee + export let value: WithLookup export let shouldShowAvatar: boolean = true let container: HTMLElement @@ -14,8 +15,7 @@ showPopup( EmployeePreviewPopup, { - employeeId: value._id, - space: value.space + employeeId: value._id }, container ) @@ -26,9 +26,11 @@
-
- -
+ {#if value.$lookup?.statuses?.length} +
+ +
+ {/if}