Fixed a bug where user couldn't craewte boards from templates (#1319)

This commit is contained in:
Harshil Sharma 2021-09-23 13:12:36 +05:30 committed by GitHub
parent a8da028bc7
commit 0f9486262e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -645,7 +645,7 @@ class Mutator {
beforeUndo?: () => Promise<void>,
): 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<string, string>]
const newBlocks = newBlocks1.filter((o) => o.type !== 'comment')
Utils.log(`duplicateBoard: duplicating ${newBlocks.length} blocks`)

View file

@ -166,8 +166,8 @@ class OctoClient {
return user
}
async getSubtree(rootId?: string, levels = 2): Promise<Block[]> {
let path = this.workspacePath() + `/blocks/${encodeURIComponent(rootId || '')}/subtree?l=${levels}`
async getSubtree(rootId?: string, levels = 2, workspaceID?: string): Promise<Block[]> {
let path = this.workspacePath(workspaceID) + `/blocks/${encodeURIComponent(rootId || '')}/subtree?l=${levels}`
const readToken = this.readToken()
if (readToken) {
path += `&read_token=${readToken}`