mirror of
https://github.com/mattermost/focalboard.git
synced 2025-01-17 18:26:17 +02:00
Refactor templateCopy
This commit is contained in:
parent
02d26a800a
commit
3961a8a314
@ -408,7 +408,7 @@ class MutableBoardTree implements BoardTree {
|
|||||||
}
|
}
|
||||||
|
|
||||||
templateCopy(): MutableBoardTree {
|
templateCopy(): MutableBoardTree {
|
||||||
const [newBlocks, newBoard] = OctoUtils.duplicateBlockTree(this.allBlocks, this.board.id)
|
const [newBlocks, newBoard] = OctoUtils.duplicateBlockTree(this.rawBlocks, this.board.id)
|
||||||
|
|
||||||
const boardTree = new MutableBoardTree(newBoard.id)
|
const boardTree = new MutableBoardTree(newBoard.id)
|
||||||
boardTree.incrementalUpdate(newBlocks)
|
boardTree.incrementalUpdate(newBlocks)
|
||||||
|
@ -58,16 +58,10 @@ class MutableCardTree implements CardTree {
|
|||||||
}
|
}
|
||||||
|
|
||||||
templateCopy(): MutableCardTree {
|
templateCopy(): MutableCardTree {
|
||||||
const card = this.card.duplicate()
|
const [newBlocks, newCard] = OctoUtils.duplicateBlockTree(this.rawBlocks, this.card.id)
|
||||||
|
|
||||||
const contents: IOrderedBlock[] = this.contents.map((content) => {
|
const cardTree = new MutableCardTree(newCard.id)
|
||||||
const copy = MutableBlock.duplicate(content)
|
cardTree.incrementalUpdate(newBlocks)
|
||||||
copy.parentId = card.id
|
|
||||||
return copy as IOrderedBlock
|
|
||||||
})
|
|
||||||
|
|
||||||
const cardTree = new MutableCardTree(card.id)
|
|
||||||
cardTree.incrementalUpdate([card, ...contents])
|
|
||||||
return cardTree
|
return cardTree
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user