Fix integration migration (#3272)

This commit is contained in:
Denis Bykhov 2023-05-28 12:34:10 +06:00 committed by GitHub
parent b46b65fe5d
commit 33d46ae734
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,14 +73,15 @@ async function fillMigrationCollaborator (tx: TxOperations): Promise<void> {
for (const value of settings) { for (const value of settings) {
if (h.hasMixin(value, notification.mixin.Collaborators)) { if (h.hasMixin(value, notification.mixin.Collaborators)) {
const collabs = h.as<Doc, Collaborators>(value, notification.mixin.Collaborators) const collabs = h.as<Doc, Collaborators>(value, notification.mixin.Collaborators)
if (collabs.collaborators === undefined || !collabs.collaborators.includes(collabs.modifiedBy)) { const target = collabs.createdBy ?? collabs.modifiedBy
if (collabs.collaborators === undefined || !collabs.collaborators.includes(target)) {
const res = tx.txFactory.createTxMixin<Doc, Collaborators>( const res = tx.txFactory.createTxMixin<Doc, Collaborators>(
value._id, value._id,
value._class, value._class,
value.space, value.space,
notification.mixin.Collaborators, notification.mixin.Collaborators,
{ {
collaborators: [collabs.createdBy ?? collabs.modifiedBy] collaborators: [target]
} }
) )
res.space = core.space.DerivedTx res.space = core.space.DerivedTx