diff --git a/plugins/activity-resources/src/activityMessagesUtils.ts b/plugins/activity-resources/src/activityMessagesUtils.ts index 924ccee1ab..72623ba79e 100644 --- a/plugins/activity-resources/src/activityMessagesUtils.ts +++ b/plugins/activity-resources/src/activityMessagesUtils.ts @@ -488,3 +488,15 @@ export function getClosestDateSelectorDate (date: Timestamp, scrollElement: HTML return closestDate } + +export function isReactionMessage (message?: ActivityMessage): message is DocUpdateMessage { + if (message === undefined) { + return false + } + + if (message._class !== activity.class.DocUpdateMessage) { + return false + } + + return (message as DocUpdateMessage).objectClass === activity.class.Reaction +} diff --git a/plugins/activity-resources/src/components/activity-message/ActivityMessageTemplate.svelte b/plugins/activity-resources/src/components/activity-message/ActivityMessageTemplate.svelte index d47432ffe7..fe1a2c34f6 100644 --- a/plugins/activity-resources/src/components/activity-message/ActivityMessageTemplate.svelte +++ b/plugins/activity-resources/src/components/activity-message/ActivityMessageTemplate.svelte @@ -216,7 +216,7 @@ overflow: hidden; border: 1px solid transparent; border-radius: 0.25rem; - width: calc(100% - 2rem); + width: 100%; &.clickable { cursor: pointer; diff --git a/plugins/activity-resources/src/components/reactions/ReactionNotificationPresenter.svelte b/plugins/activity-resources/src/components/reactions/ReactionNotificationPresenter.svelte index 32ca122236..2adc4f3b25 100644 --- a/plugins/activity-resources/src/components/reactions/ReactionNotificationPresenter.svelte +++ b/plugins/activity-resources/src/components/reactions/ReactionNotificationPresenter.svelte @@ -17,12 +17,17 @@ import activity, { ActivityMessage, DisplayActivityMessage } from '@hcengineering/activity' import { createQuery } from '@hcengineering/presentation' import { Ref } from '@hcengineering/core' - import { getLocation, navigate } from '@hcengineering/ui' + import { Action, getLocation, navigate } from '@hcengineering/ui' + import ActivityMessagePresenter from '../activity-message/ActivityMessagePresenter.svelte' export let message: DisplayActivityMessage export let notification: ActivityInboxNotification export let embedded = false + export let showNotify = true + export let withActions = true + export let actions: Action[] = [] + export let excludedActions: string[] = [] export let onClick: (() => void) | undefined = undefined const parentQuery = createQuery() @@ -43,7 +48,28 @@ {#if embedded && parentMessage} - + {:else if !embedded && message} - + {/if} diff --git a/plugins/chunter-resources/src/components/Channel.svelte b/plugins/chunter-resources/src/components/Channel.svelte index 1875d83908..00a68fdf65 100644 --- a/plugins/chunter-resources/src/components/Channel.svelte +++ b/plugins/chunter-resources/src/components/Channel.svelte @@ -18,10 +18,11 @@ import { location as locationStore } from '@hcengineering/ui' import { onDestroy } from 'svelte' import activity, { ActivityMessage, ActivityMessagesFilter } from '@hcengineering/activity' - import { ActivityScrolledView } from '@hcengineering/activity-resources' + import { ActivityScrolledView, isReactionMessage } from '@hcengineering/activity-resources' import { getClient } from '@hcengineering/presentation' import chunter from '../plugin' + import { InboxNotificationsClientImpl } from '@hcengineering/notification-resources' export let context: DocNotifyContext export let object: Doc @@ -29,11 +30,20 @@ const client = getClient() const hierarchy = client.getHierarchy() + const inboxClient = InboxNotificationsClientImpl.getClient() + const activityInboxNotificationsStore = inboxClient.activityInboxNotifications let selectedMessageId: Ref | undefined = undefined const unsubscribe = locationStore.subscribe((newLocation) => { selectedMessageId = newLocation.query?.message as Ref | undefined + const selectedMessage = selectedMessageId + ? $activityInboxNotificationsStore.find(({ attachedTo }) => attachedTo === selectedMessageId)?.$lookup?.attachedTo + : undefined + + if (isReactionMessage(selectedMessage)) { + selectedMessageId = selectedMessage.attachedTo as Ref + } }) onDestroy(unsubscribe) diff --git a/plugins/chunter-resources/src/components/ChannelPanel.svelte b/plugins/chunter-resources/src/components/ChannelPanel.svelte index 25901c7efc..e85c8c5cda 100644 --- a/plugins/chunter-resources/src/components/ChannelPanel.svelte +++ b/plugins/chunter-resources/src/components/ChannelPanel.svelte @@ -18,6 +18,9 @@ import { createQuery, getClient } from '@hcengineering/presentation' import activity, { ActivityMessage } from '@hcengineering/activity' import { ChunterSpace } from '@hcengineering/chunter' + import { InboxNotificationsClientImpl } from '@hcengineering/notification-resources' + import { location as locationStore } from '@hcengineering/ui' + import { isReactionMessage } from '@hcengineering/activity-resources' import ChannelPresenter from './ChannelView.svelte' import ThreadViewPanel from './threads/ThreadViewPanel.svelte' @@ -28,15 +31,29 @@ const objectQuery = createQuery() const client = getClient() + const inboxClient = InboxNotificationsClientImpl.getClient() + const activityInboxNotificationsStore = inboxClient.activityInboxNotifications const hierarchy = client.getHierarchy() let object: ChunterSpace | undefined = undefined let threadId: Ref | undefined = undefined - $: threadId = hierarchy.isDerived(context.attachedToClass, activity.class.ActivityMessage) - ? (context.attachedTo as Ref) + let selectedMessageId: Ref | undefined = undefined + + locationStore.subscribe((newLocation) => { + selectedMessageId = newLocation.query?.message as Ref | undefined + }) + + $: notification = selectedMessageId + ? $activityInboxNotificationsStore.find(({ attachedTo }) => attachedTo === selectedMessageId) : undefined + $: threadId = + hierarchy.isDerived(context.attachedToClass, activity.class.ActivityMessage) && + !isReactionMessage(notification?.$lookup?.attachedTo) + ? (context.attachedTo as Ref) + : undefined + $: objectQuery.query(_class, { _id }, (res) => { object = res[0] }) diff --git a/plugins/chunter-resources/src/components/DirectIcon.svelte b/plugins/chunter-resources/src/components/DirectIcon.svelte index f32a916b0e..64fb837688 100644 --- a/plugins/chunter-resources/src/components/DirectIcon.svelte +++ b/plugins/chunter-resources/src/components/DirectIcon.svelte @@ -41,13 +41,13 @@ {/if} {#if persons.length === 1} - + {/if} {#if persons.length > 1 && size === 'medium'}
{#each persons.slice(0, visiblePersons - 1) as person} - + {/each} {#if persons.length > visiblePersons}
diff --git a/plugins/chunter-resources/src/components/notification/ThreadNotificationPresenter.svelte b/plugins/chunter-resources/src/components/notification/ThreadNotificationPresenter.svelte index 6b32eec1ef..5a59258672 100644 --- a/plugins/chunter-resources/src/components/notification/ThreadNotificationPresenter.svelte +++ b/plugins/chunter-resources/src/components/notification/ThreadNotificationPresenter.svelte @@ -15,12 +15,16 @@ - + diff --git a/plugins/chunter-resources/src/components/threads/ThreadMessagePresenter.svelte b/plugins/chunter-resources/src/components/threads/ThreadMessagePresenter.svelte index 89b330d673..e172b2bcf1 100644 --- a/plugins/chunter-resources/src/components/threads/ThreadMessagePresenter.svelte +++ b/plugins/chunter-resources/src/components/threads/ThreadMessagePresenter.svelte @@ -15,6 +15,7 @@ @@ -41,6 +44,8 @@ {embedded} {skipLabel} {withFlatActions} + {excludedActions} + {actions} {onClick} {onReply} /> diff --git a/plugins/notification-resources/src/components/DocNotifyContextCard.svelte b/plugins/notification-resources/src/components/DocNotifyContextCard.svelte index 686e168fcf..1d70312819 100644 --- a/plugins/notification-resources/src/components/DocNotifyContextCard.svelte +++ b/plugins/notification-resources/src/components/DocNotifyContextCard.svelte @@ -58,6 +58,7 @@ value.attachedToClass, notification.mixin.NotificationContextPresenter ) + $: isCompact = notifications.length === 1 {#if visibleNotification} @@ -66,69 +67,88 @@
{ dispatch('click', { context: value, notification: visibleNotification }) }} > -
- - - - - - - - - - {#if presenterMixin?.labelPresenter} - - {:else} -
- {#await getDocIdentifier(client, value.attachedTo, value.attachedToClass) then title} - {#if title} - {title} - {:else} -
- {/if} - -
+ {#if isCompact} + +
-
+
-
+ {:else} +
+ + + + + + + + -
- -
+ {#if presenterMixin?.labelPresenter} + + {:else} +
+ {#await getDocIdentifier(client, value.attachedTo, value.attachedToClass) then title} + {#if title} + {title} + {:else} +
+ {/if} + +
+ +
+ +
+ +
+
+ +
+ +
+ {/if}
{/if} diff --git a/plugins/notification-resources/src/components/inbox/ActivityInboxNotificationPresenter.svelte b/plugins/notification-resources/src/components/inbox/ActivityInboxNotificationPresenter.svelte index 04c20a967e..71d36fa38b 100644 --- a/plugins/notification-resources/src/components/inbox/ActivityInboxNotificationPresenter.svelte +++ b/plugins/notification-resources/src/components/inbox/ActivityInboxNotificationPresenter.svelte @@ -33,6 +33,8 @@ export let value: DisplayActivityInboxNotification export let embedded = false export let skipLabel = false + export let showNotify = true + export let withActions = true export let viewlets: ActivityNotificationViewlet[] = [] export let onClick: (() => void) | undefined = undefined @@ -120,14 +122,27 @@ {#if displayMessage !== undefined} {#if viewlet} - + {:else} void) | undefined = undefined const objectQuery = createQuery() @@ -53,9 +55,7 @@ personAccount?.person !== undefined ? $employeeByIdStore.get(personAccount.person as Ref) ?? $personByIdStore.get(personAccount.person) : undefined - $: context = $docNotifyContextsStore.find(({ _id }) => _id === value.docNotifyContext) - $: context && objectQuery.query(context.attachedToClass, { _id: context.attachedTo }, (result) => { object = result[0] @@ -95,7 +95,7 @@
{#if !embedded} - {#if !value.isViewed} + {#if !value.isViewed && showNotify}
{/if} @@ -142,7 +142,7 @@
- {#if !embedded} + {#if !embedded && withActions}
diff --git a/plugins/notification-resources/src/components/inbox/Inbox.svelte b/plugins/notification-resources/src/components/inbox/Inbox.svelte index 1511b67e01..99fdb3d8e8 100644 --- a/plugins/notification-resources/src/components/inbox/Inbox.svelte +++ b/plugins/notification-resources/src/components/inbox/Inbox.svelte @@ -154,7 +154,7 @@ if (selectedContext !== undefined) { loc.fragment = selectedContext._id - loc.query = { message: event?.detail?.notification?.attachedTo } + loc.query = { message: event?.detail?.notification?.attachedTo ?? null } } else { loc.fragment = undefined loc.query = undefined @@ -283,7 +283,8 @@ } .notifications { - margin: 0 0.5rem; + margin: 0.5rem; + padding: 0.5rem; height: 100%; } diff --git a/plugins/notification-resources/src/components/inbox/InboxNotificationPresenter.svelte b/plugins/notification-resources/src/components/inbox/InboxNotificationPresenter.svelte index 9584a3cc06..be641c4b1d 100644 --- a/plugins/notification-resources/src/components/inbox/InboxNotificationPresenter.svelte +++ b/plugins/notification-resources/src/components/inbox/InboxNotificationPresenter.svelte @@ -17,11 +17,13 @@ import { getClient } from '@hcengineering/presentation' import { Component } from '@hcengineering/ui' import { Class, Doc, Ref } from '@hcengineering/core' - import { ActivityNotificationViewlet, DisplayInboxNotification } from '@hcengineering/notification' + import { ActivityNotificationViewlet, DisplayInboxNotification, DocNotifyContext } from '@hcengineering/notification' export let value: DisplayInboxNotification export let embedded = false export let skipLabel = false + export let showNotify = true + export let withActions = true export let viewlets: ActivityNotificationViewlet[] = [] export let onClick: (() => void) | undefined = undefined export let onCheck: ((isChecked: boolean) => void) | undefined = undefined @@ -33,5 +35,8 @@ {#if objectPresenter} - + {/if}