From decc0c5d5d37716ccd7f175453f3f76325fd1753 Mon Sep 17 00:00:00 2001 From: Kristina Date: Tue, 26 Mar 2024 07:51:41 +0400 Subject: [PATCH] Fix email notifications, fix collaborators aligment (#5062) Signed-off-by: Kristina Fefelova --- .../DocUpdateMessagePreview.svelte | 32 +++++++++++++++---- .../components/PersonAccountPresenter.svelte | 5 +-- .../PersonAccountRefPresenter.svelte | 3 +- .../activity/CollaboratorsChanged.svelte | 22 ++++++------- 4 files changed, 41 insertions(+), 21 deletions(-) diff --git a/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessagePreview.svelte b/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessagePreview.svelte index 25119d8e8b..ad549f067b 100644 --- a/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessagePreview.svelte +++ b/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessagePreview.svelte @@ -19,17 +19,18 @@ DisplayDocUpdateMessage, DocUpdateMessageViewlet } from '@hcengineering/activity' - import { Action, Component } from '@hcengineering/ui' - import { getClient } from '@hcengineering/presentation' + import { Action, Component, Icon } from '@hcengineering/ui' + import { createQuery, getClient } from '@hcengineering/presentation' import { IntlString } from '@hcengineering/platform' - import { AttachedDoc, Collection, Doc } from '@hcengineering/core' + import { AttachedDoc, Class, Collection, Doc, Ref } from '@hcengineering/core' import { AttributeModel } from '@hcengineering/view' + import { createEventDispatcher } from 'svelte' + import { buildRemovedDoc, checkIsObjectRemoved } from '@hcengineering/view-resources' import { getAttributeModel, getCollectionAttribute } from '../../activityMessagesUtils' import BaseMessagePreview from '../activity-message/BaseMessagePreview.svelte' import DocUpdateMessageContent from './DocUpdateMessageContent.svelte' import DocUpdateMessageAttributes from './DocUpdateMessageAttributes.svelte' - import { createEventDispatcher } from 'svelte' export let value: DisplayDocUpdateMessage export let readonly = false @@ -40,6 +41,8 @@ const hierarchy = client.getHierarchy() const dispatch = createEventDispatcher() + const objectQuery = createQuery() + let viewlet: DocUpdateMessageViewlet | undefined let objectName: IntlString | undefined = undefined let collectionName: IntlString | undefined = undefined @@ -61,6 +64,19 @@ attributeModel = model }) + $: viewlet?.component && loadObject(value.objectId, value.objectClass) + + async function loadObject (_id: Ref, _class: Ref>): Promise { + const isObjectRemoved = await checkIsObjectRemoved(client, _id, _class) + + if (isObjectRemoved) { + object = await buildRemovedDoc(client, _id, _class) + } else { + objectQuery.query(_class, { _id }, (res) => { + object = res[0] + }) + } + } function onClick (event: MouseEvent): void { event.stopPropagation() event.preventDefault() @@ -69,9 +85,11 @@ - + {#if viewlet?.component && object} -
+ + + {#each value?.previousMessages ?? [] as msg} -
+
{:else if value.action === 'create' || value.action === 'remove'} ) @@ -38,9 +39,9 @@ {#if value} {#if employee} - + {:else if person} - + {:else}
diff --git a/plugins/contact-resources/src/components/PersonAccountRefPresenter.svelte b/plugins/contact-resources/src/components/PersonAccountRefPresenter.svelte index 15715c91cd..59fb55a10c 100644 --- a/plugins/contact-resources/src/components/PersonAccountRefPresenter.svelte +++ b/plugins/contact-resources/src/components/PersonAccountRefPresenter.svelte @@ -25,10 +25,11 @@ export let disabled: boolean = false export let inline: boolean = false export let accent: boolean = false + export let compact = false $: account = $personAccountByIdStore.get(value) {#if account} - + {/if} diff --git a/plugins/notification-resources/src/components/activity/CollaboratorsChanged.svelte b/plugins/notification-resources/src/components/activity/CollaboratorsChanged.svelte index 374650fc62..e7f525d473 100644 --- a/plugins/notification-resources/src/components/activity/CollaboratorsChanged.svelte +++ b/plugins/notification-resources/src/components/activity/CollaboratorsChanged.svelte @@ -48,9 +48,9 @@ $: hasDifferentChanges = added.length > 0 && removed.length > 0 -
+ -
+ {#if hasDifferentChanges}
+
{#if added.length > 0} -
+ {#if hasDifferentChanges} {/if} {#each added as add} - + {/each} -
+ {/if} -
+ {#if removed.length > 0} -
+ {#if hasDifferentChanges} {/if} {#each removed as remove} - + {/each} -
+ {/if} -
+