diff --git a/models/activity/src/index.ts b/models/activity/src/index.ts index 8eb152b059..8a16ae5a11 100644 --- a/models/activity/src/index.ts +++ b/models/activity/src/index.ts @@ -14,6 +14,7 @@ // import { + type ActivityAttributeUpdatesPresenter, type ActivityDoc, type ActivityExtension, type ActivityExtensionKind, @@ -55,9 +56,9 @@ import { import { TAttachedDoc, TClass, TDoc } from '@hcengineering/model-core' import type { Asset, IntlString, Resource } from '@hcengineering/platform' import { type AnyComponent } from '@hcengineering/ui/src/types' +import view from '@hcengineering/model-view' import activity from './plugin' -import view from '@hcengineering/model-view' export { activityOperation } from './migration' export { activityId } from '@hcengineering/activity' @@ -70,6 +71,11 @@ export class TActivityDoc extends TClass implements ActivityDoc { ignoreCollections?: string[] } +@Mixin(activity.mixin.ActivityAttributeUpdatesPresenter, core.class.Class) +export class TActivityAttributeUpdatesPresenter extends TClass implements ActivityAttributeUpdatesPresenter { + presenter!: AnyComponent +} + @Model(activity.class.TxViewlet, core.class.Doc, DOMAIN_MODEL) export class TTxViewlet extends TDoc implements TxViewlet { icon!: Asset @@ -177,7 +183,8 @@ export function createModel (builder: Builder): void { TDocUpdateMessage, TDocUpdateMessageViewlet, TActivityExtension, - TReaction + TReaction, + TActivityAttributeUpdatesPresenter ) builder.mixin(activity.class.DocUpdateMessage, core.class.Class, activity.mixin.ActivityDoc, {}) diff --git a/models/notification/src/index.ts b/models/notification/src/index.ts index 11c4f4edfa..6a31b9b912 100644 --- a/models/notification/src/index.ts +++ b/models/notification/src/index.ts @@ -473,7 +473,7 @@ export function createModel (builder: Builder): void { notification.ids.NotificationCollaboratorsChanged ) - builder.mixin(notification.mixin.Collaborators, core.class.Class, view.mixin.ActivityAttributePresenter, { + builder.mixin(notification.mixin.Collaborators, core.class.Class, activity.mixin.ActivityAttributeUpdatesPresenter, { presenter: notification.component.NotificationCollaboratorsChanged }) diff --git a/models/view/src/index.ts b/models/view/src/index.ts index 0e8c98dc67..f26068bc68 100644 --- a/models/view/src/index.ts +++ b/models/view/src/index.ts @@ -469,7 +469,8 @@ export function createModel (builder: Builder): void { core.class.TypeMarkup, view.component.MarkupPresenter, view.component.MarkupEditor, - view.component.MarkupEditorPopup + view.component.MarkupEditorPopup, + view.component.MarkupDiffPresenter ) builder.mixin(core.class.TypeMarkup, core.class.Class, view.mixin.InlineAttributEditor, { diff --git a/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessageAttributes.svelte b/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessageAttributes.svelte index 10020fc9b3..60e525bb80 100644 --- a/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessageAttributes.svelte +++ b/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessageAttributes.svelte @@ -14,10 +14,12 @@ --> {#if presenter} diff --git a/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessageObjectValue.svelte b/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessageObjectValue.svelte index 5104c91b98..92f86640b4 100644 --- a/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessageObjectValue.svelte +++ b/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessageObjectValue.svelte @@ -32,11 +32,7 @@ let object: Doc | undefined = undefined - async function getValue (object: Doc | undefined): Promise { - if (object === undefined) { - return '' - } - + async function getValue (object: Doc): Promise { if (viewlet?.valueAttr) { return (object as any)[viewlet.valueAttr] } @@ -60,15 +56,17 @@ {#if object} - {#await getValue(object) then value} - {#if withIcon && message.action === 'create'} - - {/if} - {#if withIcon && message.action === 'remove'} - - {/if} + {#if withIcon && message.action === 'create'} + + {/if} + {#if withIcon && message.action === 'remove'} + + {/if} - {#if value} + {#if objectPresenter && !viewlet?.valueAttr} + + {:else} + {#await getValue(object) then value} , {/if} - {:else if objectPresenter && object} - - {/if} - {/await} + {/await} + {/if} {/if}