1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-01-05 14:50:29 +02:00

Fixed a bug preventing new template being created from a card (#1951)

* Fixed a bug preventing new template being created from a card

* Fixed a test
This commit is contained in:
Harshil Sharma 2021-12-09 16:35:35 +05:30 committed by GitHub
parent a1e1e2dfd0
commit 42eb5ad6be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -38,7 +38,7 @@ describe('Mutator', () => {
const board = TestBlockFactory.createBoard()
FetchMock.fn.mockReturnValueOnce(FetchMock.jsonResponse(JSON.stringify([card])))
FetchMock.fn.mockReturnValueOnce(FetchMock.jsonResponse(JSON.stringify({})))
FetchMock.fn.mockReturnValueOnce(FetchMock.jsonResponse(JSON.stringify([])))
const [newBlocks, newCardID] = await mutator.duplicateCard(card.id, board)
expect(newBlocks).toHaveLength(1)

View File

@ -682,7 +682,12 @@ class Mutator {
newBlocks,
description,
async (respBlocks: Block[]) => {
await afterRedo?.(respBlocks[0].id)
const card = respBlocks.find((block) => block.type === 'card')
if (card) {
await afterRedo?.(card.id)
} else {
Utils.logError('card not found for opening.')
}
},
beforeUndo,
)