mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-12 20:57:45 +02:00
UBERF-4725 Migrate collaborative content (#5717)
Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
@@ -1214,10 +1214,6 @@ async function updateId (
|
||||
const markup = (contentDoc as any)[attrName] as Markup
|
||||
const newMarkup = markup.replaceAll(doc._id, newId)
|
||||
await update(h, db, contentDoc, { [attrName]: newMarkup })
|
||||
} else if (attr.type._class === core.class.TypeCollaborativeMarkup) {
|
||||
const markup = (contentDoc as any)[attrName]
|
||||
const newMarkup = markup.replaceAll(doc._id, newId)
|
||||
await update(h, db, contentDoc, { [attrName]: newMarkup })
|
||||
} else if (attr.type._class === core.class.TypeCollaborativeDoc) {
|
||||
const collaborativeDoc = (contentDoc as any)[attr.name] as CollaborativeDoc
|
||||
await updateYDoc(ctx, collaborativeDoc, storage, workspaceId, contentDoc, newId, doc)
|
||||
|
||||
@@ -7,7 +7,7 @@ import core, {
|
||||
type MeasureContext,
|
||||
type Ref,
|
||||
type WorkspaceId,
|
||||
getCollaborativeDocId
|
||||
makeCollaborativeDoc
|
||||
} from '@hcengineering/core'
|
||||
import { getMongoClient, getWorkspaceDB } from '@hcengineering/mongo'
|
||||
import { type StorageAdapter } from '@hcengineering/server-core'
|
||||
@@ -39,10 +39,7 @@ export async function fixJsonMarkup (
|
||||
|
||||
const attributes = hierarchy.getAllAttributes(_class)
|
||||
const filtered = Array.from(attributes.values()).filter((attribute) => {
|
||||
return (
|
||||
hierarchy.isDerived(attribute.type._class, core.class.TypeMarkup) ||
|
||||
hierarchy.isDerived(attribute.type._class, core.class.TypeCollaborativeMarkup)
|
||||
)
|
||||
return hierarchy.isDerived(attribute.type._class, core.class.TypeMarkup)
|
||||
})
|
||||
if (filtered.length === 0) continue
|
||||
|
||||
@@ -88,7 +85,7 @@ async function processFixJsonMarkupFor (
|
||||
}
|
||||
if (res !== value) {
|
||||
update[attribute.name] = res
|
||||
remove.push(getCollaborativeDocId(doc._id, attribute.name))
|
||||
remove.push(makeCollaborativeDoc(doc._id, attribute.name))
|
||||
}
|
||||
}
|
||||
} catch {}
|
||||
|
||||
Reference in New Issue
Block a user