From 0f9486262e391170c8cd0d9b037c0102f745b86f Mon Sep 17 00:00:00 2001 From: Harshil Sharma Date: Thu, 23 Sep 2021 13:12:36 +0530 Subject: [PATCH] Fixed a bug where user couldn't craewte boards from templates (#1319) --- webapp/src/mutator.ts | 2 +- webapp/src/octoClient.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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}`