Skip to content

Commit

Permalink
Fixed a bug causing undeleted board to not have original title (matte…
Browse files Browse the repository at this point in the history
  • Loading branch information
harshilsharma63 authored Jul 13, 2022
1 parent 2f4f13c commit cdf8fbc
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
2 changes: 1 addition & 1 deletion server/services/store/sqlstore/board.go
Original file line number Diff line number Diff line change
Expand Up @@ -774,8 +774,8 @@ func (s *SQLStore) undeleteBoard(db sq.BaseRunner, boardID string, modifiedBy st
board.CreatedBy,
modifiedBy,
board.Type,
board.MinimumRole,
board.Title,
board.MinimumRole,
board.Description,
board.Icon,
board.ShowDescription,
Expand Down
34 changes: 31 additions & 3 deletions server/services/store/storetests/boards.go
Original file line number Diff line number Diff line change
Expand Up @@ -803,9 +803,23 @@ func testUndeleteBoard(t *testing.T, store store.Store) {
boardID := utils.NewID(utils.IDTypeBoard)

board := &model.Board{
ID: boardID,
TeamID: testTeamID,
Type: model.BoardTypeOpen,
ID: boardID,
TeamID: testTeamID,
Type: model.BoardTypeOpen,
Title: "Dunder Mifflin Scranton",
MinimumRole: model.BoardRoleCommenter,
Description: "Bears, beets, Battlestar Gallectica",
Icon: "🐻",
ShowDescription: true,
IsTemplate: false,
Properties: map[string]interface{}{
"prop_1": "value_1",
},
CardProperties: []map[string]interface{}{
{
"prop_1": "value_1",
},
},
}

newBoard, err := store.InsertBoard(board, userID)
Expand All @@ -828,6 +842,20 @@ func testUndeleteBoard(t *testing.T, store store.Store) {
board, err = store.GetBoard(boardID)
require.NoError(t, err)
require.NotNil(t, board)

// verifying the data after un-delete
require.Equal(t, "Dunder Mifflin Scranton", board.Title)
require.Equal(t, "user-id", board.CreatedBy)
require.Equal(t, "user-id", board.ModifiedBy)
require.Equal(t, model.BoardRoleCommenter, board.MinimumRole)
require.Equal(t, "Bears, beets, Battlestar Gallectica", board.Description)
require.Equal(t, "🐻", board.Icon)
require.True(t, board.ShowDescription)
require.False(t, board.IsTemplate)
require.Equal(t, board.Properties["prop_1"].(string), "value_1")
require.Equal(t, 1, len(board.CardProperties))
require.Equal(t, board.CardProperties[0]["prop_1"], "value_1")
require.Equal(t, board.CardProperties[0]["prop_1"], "value_1")
})

t.Run("existing id multiple times", func(t *testing.T) {
Expand Down

0 comments on commit cdf8fbc

Please sign in to comment.