diff --git a/webapp/src/mutator.ts b/webapp/src/mutator.ts index bbdb78bb1..b3d813001 100644 --- a/webapp/src/mutator.ts +++ b/webapp/src/mutator.ts @@ -645,7 +645,7 @@ class Mutator { beforeUndo?: () => Promise, ): Promise<[Block[], string]> { const rootClient = new OctoClient(octoClient.serverUrl, '0') - const blocks = await rootClient.getSubtree(boardId, 3) + const blocks = await rootClient.getSubtree(boardId, 3, '0') const [newBlocks1, newBoard] = OctoUtils.duplicateBlockTree(blocks, boardId) as [Block[], Board, Record] const newBlocks = newBlocks1.filter((o) => o.type !== 'comment') Utils.log(`duplicateBoard: duplicating ${newBlocks.length} blocks`) diff --git a/webapp/src/octoClient.ts b/webapp/src/octoClient.ts index 39747af41..5e3fbddc0 100644 --- a/webapp/src/octoClient.ts +++ b/webapp/src/octoClient.ts @@ -166,8 +166,8 @@ class OctoClient { return user } - async getSubtree(rootId?: string, levels = 2): Promise { - let path = this.workspacePath() + `/blocks/${encodeURIComponent(rootId || '')}/subtree?l=${levels}` + async getSubtree(rootId?: string, levels = 2, workspaceID?: string): Promise { + let path = this.workspacePath(workspaceID) + `/blocks/${encodeURIComponent(rootId || '')}/subtree?l=${levels}` const readToken = this.readToken() if (readToken) { path += `&read_token=${readToken}`