diff --git a/plugins/notification-resources/src/components/EmployeeInbox.svelte b/plugins/notification-resources/src/components/EmployeeInbox.svelte index 92a1ff1c2c..82df6678ca 100644 --- a/plugins/notification-resources/src/components/EmployeeInbox.svelte +++ b/plugins/notification-resources/src/components/EmployeeInbox.svelte @@ -115,9 +115,8 @@ const client = getClient() async function openDM () { - const current = (await client.findAll(chunter.class.DirectMessage, { members: accountId })).find( - (p) => p.members.length === 2 - ) + const res = await client.findAll(chunter.class.DirectMessage, { members: accountId }) + const current = res.find((p) => p.members.includes(me) && p.members.length === 2) if (current !== undefined) { dispatch('dm', current._id) } else { diff --git a/plugins/notification-resources/src/components/NotificationPresenter.svelte b/plugins/notification-resources/src/components/NotificationPresenter.svelte index d2d58f9389..06798c001d 100644 --- a/plugins/notification-resources/src/components/NotificationPresenter.svelte +++ b/plugins/notification-resources/src/components/NotificationPresenter.svelte @@ -24,7 +24,7 @@ const store = notificationClient.docUpdatesStore $: docUpdate = $store.get(value._id) - $: hasNotification = (docUpdate?.txes?.length ?? 0) > 0 && docUpdate?.hidden !== true + $: hasNotification = docUpdate?.txes?.some((p) => p.isNew) && docUpdate?.hidden !== true {#if hasNotification} diff --git a/plugins/notification-resources/src/components/NotificationView.svelte b/plugins/notification-resources/src/components/NotificationView.svelte index ce04f0faf1..cb500591c4 100644 --- a/plugins/notification-resources/src/components/NotificationView.svelte +++ b/plugins/notification-resources/src/components/NotificationView.svelte @@ -34,8 +34,10 @@ const client = getClient() const hierarchy = client.getHierarchy() - $: value.txes[0] && - client.findOne(core.class.TxCUD, { _id: value.txes[0]._id }).then((res) => { + $: txRef = value.txes[value.txes.length - 1]._id + + $: txRef && + client.findOne(core.class.TxCUD, { _id: txRef }).then((res) => { if (res !== undefined) { tx = TxProcessor.extractTx(res) as TxCUD } else { @@ -64,9 +66,9 @@ -
-
- {#if doc} +{#if doc} +
+
- {/if} -
+
+{/if}