From a0ecb3c04fc458510a1a4902725f292e5f8c3831 Mon Sep 17 00:00:00 2001 From: Vyacheslav Tumanov Date: Tue, 4 Jul 2023 23:45:36 +0500 Subject: [PATCH] UBER-560: filter out current transaction and get mixin (#3480) Signed-off-by: Vyacheslav Tumanov --- server-plugins/notification-resources/src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server-plugins/notification-resources/src/index.ts b/server-plugins/notification-resources/src/index.ts index ee21449cd8..3979653956 100644 --- a/server-plugins/notification-resources/src/index.ts +++ b/server-plugins/notification-resources/src/index.ts @@ -631,8 +631,9 @@ async function updateCollaboratorsMixin ( const mixinTxes = await control.findAll(core.class.TxMixin, { objectId: tx.objectId }) - const prevDoc = TxProcessor.buildDoc2Doc([createTx, ...mixinTxes]) as Collaborators - const set = new Set(prevDoc?.collaborators ?? []) + const prevDoc = TxProcessor.buildDoc2Doc([createTx, ...mixinTxes].filter((t) => t._id !== tx._id)) as Collaborators + const prevDocMixin = control.hierarchy.as(prevDoc, notification.mixin.Collaborators) + const set = new Set(prevDocMixin?.collaborators ?? []) const newCollabs: Ref[] = [] for (const collab of tx.attributes.collaborators) { if (!set.has(collab)) {