Fix integration notification (#3213)

This commit is contained in:
Denis Bykhov 2023-05-19 08:21:42 +06:00 committed by GitHub
parent 074fa7dbc4
commit e529248795
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -74,7 +74,7 @@ async function fillMigrationCollaborator (tx: TxOperations): Promise<void> {
if (h.hasMixin(value, notification.mixin.Collaborators)) {
const collabs = h.as<Doc, Collaborators>(value, notification.mixin.Collaborators)
if (collabs.collaborators === undefined || !collabs.collaborators.includes(collabs.modifiedBy)) {
await tx.updateMixin<Doc, Collaborators>(
const res = tx.txFactory.createTxMixin<Doc, Collaborators>(
value._id,
value._class,
value.space,
@ -83,9 +83,11 @@ async function fillMigrationCollaborator (tx: TxOperations): Promise<void> {
collaborators: [collabs.createdBy ?? collabs.modifiedBy]
}
)
res.space = core.space.DerivedTx
await tx.tx(res)
}
} else {
await tx.createMixin<Doc, Collaborators>(
const res = tx.txFactory.createTxMixin<Doc, Collaborators>(
value._id,
setting.class.Integration,
value.space,
@ -94,6 +96,8 @@ async function fillMigrationCollaborator (tx: TxOperations): Promise<void> {
collaborators: [value.createdBy ?? value.modifiedBy]
}
)
res.space = core.space.DerivedTx
await tx.tx(res)
}
}
}

View File

@ -333,7 +333,7 @@ export async function OnChannelUpdate (tx: Tx, control: TriggerControl): Promise
)
}
} else {
control.txFactory.createTxMixin<Doc, Collaborators>(
const res = control.txFactory.createTxMixin<Doc, Collaborators>(
doc._id,
doc._class,
doc.space,
@ -342,7 +342,7 @@ export async function OnChannelUpdate (tx: Tx, control: TriggerControl): Promise
collaborators: [tx.modifiedBy]
}
)
result.push()
result.push(res)
}
}
}