UBER-560: filter out current transaction and get mixin (#3480)

Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
Vyacheslav Tumanov 2023-07-04 23:45:36 +05:00 committed by GitHub
parent 352404533b
commit a0ecb3c04f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<Account>[] = []
for (const collab of tx.attributes.collaborators) {
if (!set.has(collab)) {