mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-22 01:25:00 +02:00
UBERF-9429: Provide workspace ids to storage adapters (#7956)
Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
This commit is contained in:
@@ -22,8 +22,7 @@ import {
|
||||
SortingOrder,
|
||||
type Class,
|
||||
type CollaborativeDoc,
|
||||
type Doc,
|
||||
type WorkspaceDataId
|
||||
type Doc
|
||||
} from '@hcengineering/core'
|
||||
import { type Document, type DocumentSnapshot, type Teamspace } from '@hcengineering/document'
|
||||
import {
|
||||
@@ -209,8 +208,7 @@ async function renameFieldsRevert (client: MigrationClient): Promise<void> {
|
||||
|
||||
try {
|
||||
const collabId = makeDocCollabId(document, 'content')
|
||||
const dataId = client.wsIds.dataId ?? (client.wsIds.uuid as unknown as WorkspaceDataId)
|
||||
const ydoc = await loadCollabYdoc(ctx, storage, dataId, collabId)
|
||||
const ydoc = await loadCollabYdoc(ctx, storage, client.wsIds, collabId)
|
||||
if (ydoc === undefined) {
|
||||
continue
|
||||
}
|
||||
@@ -221,7 +219,7 @@ async function renameFieldsRevert (client: MigrationClient): Promise<void> {
|
||||
|
||||
yDocCopyXmlField(ydoc, 'description', 'content')
|
||||
|
||||
await saveCollabYdoc(ctx, storage, dataId, collabId, ydoc)
|
||||
await saveCollabYdoc(ctx, storage, client.wsIds, collabId, ydoc)
|
||||
} catch (err) {
|
||||
ctx.error('error document content migration', { error: err, document: document.title })
|
||||
}
|
||||
@@ -257,8 +255,7 @@ async function restoreContentField (client: MigrationClient): Promise<void> {
|
||||
for (const document of documents) {
|
||||
try {
|
||||
const collabId = makeDocCollabId(document, 'content')
|
||||
const dataId = client.wsIds.dataId ?? (client.wsIds.uuid as unknown as WorkspaceDataId)
|
||||
const ydoc = await loadCollabYdoc(ctx, storage, dataId, collabId)
|
||||
const ydoc = await loadCollabYdoc(ctx, storage, client.wsIds, collabId)
|
||||
if (ydoc === undefined) {
|
||||
ctx.error('document content not found', { document: document.title })
|
||||
continue
|
||||
@@ -272,7 +269,7 @@ async function restoreContentField (client: MigrationClient): Promise<void> {
|
||||
if (ydoc.share.has('')) {
|
||||
yDocCopyXmlField(ydoc, '', 'content')
|
||||
if (ydoc.share.has('content')) {
|
||||
await saveCollabYdoc(ctx, storage, dataId, collabId, ydoc)
|
||||
await saveCollabYdoc(ctx, storage, client.wsIds, collabId, ydoc)
|
||||
} else {
|
||||
ctx.error('document content still not found', { document: document.title })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user