mirror of
https://github.com/mattermost/focalboard.git
synced 2024-11-24 08:22:29 +02:00
Don't set cattegory for board template (#4386)
This commit is contained in:
parent
401062d128
commit
20f81074da
@ -189,9 +189,11 @@ func (a *App) DuplicateBoard(boardID, userID, toTeam string, asTemplate bool) (*
|
||||
a.logger.Error("Could not copy files while duplicating board", mlog.String("BoardID", boardID), mlog.Err(err))
|
||||
}
|
||||
|
||||
for _, board := range bab.Boards {
|
||||
if categoryErr := a.setBoardCategoryFromSource(boardID, board.ID, userID, toTeam, asTemplate); categoryErr != nil {
|
||||
return nil, nil, categoryErr
|
||||
if !asTemplate {
|
||||
for _, board := range bab.Boards {
|
||||
if categoryErr := a.setBoardCategoryFromSource(boardID, board.ID, userID, toTeam, asTemplate); categoryErr != nil {
|
||||
return nil, nil, categoryErr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -503,4 +503,39 @@ func TestDuplicateBoard(t *testing.T) {
|
||||
assert.NotNil(t, bab)
|
||||
assert.NotNil(t, members)
|
||||
})
|
||||
|
||||
t.Run("duplicating board as template should not set it's category", func(t *testing.T) {
|
||||
board := &model.Board{
|
||||
ID: "board_id_2",
|
||||
Title: "Duplicated Board",
|
||||
}
|
||||
|
||||
block := &model.Block{
|
||||
ID: "block_id_1",
|
||||
Type: "image",
|
||||
}
|
||||
|
||||
th.Store.EXPECT().DuplicateBoard("board_id_1", "user_id_1", "team_id_1", true).Return(
|
||||
&model.BoardsAndBlocks{
|
||||
Boards: []*model.Board{
|
||||
board,
|
||||
},
|
||||
Blocks: []*model.Block{
|
||||
block,
|
||||
},
|
||||
},
|
||||
[]*model.BoardMember{},
|
||||
nil,
|
||||
)
|
||||
|
||||
th.Store.EXPECT().GetBoard("board_id_1").Return(&model.Board{}, nil)
|
||||
|
||||
// for WS change broadcast
|
||||
th.Store.EXPECT().GetMembersForBoard(utils.Anything).Return([]*model.BoardMember{}, nil).Times(2)
|
||||
|
||||
bab, members, err := th.App.DuplicateBoard("board_id_1", "user_id_1", "team_id_1", true)
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, bab)
|
||||
assert.NotNil(t, members)
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user