From 6f0c34ddd1ae275986ab491a05ee4ba9c30ad0b1 Mon Sep 17 00:00:00 2001 From: Scott Bishel Date: Mon, 17 Oct 2022 15:45:51 -0600 Subject: [PATCH] Gh 3953 remove channel link duplicate (#4011) --- server/services/store/sqlstore/boards_and_blocks.go | 1 + server/services/store/storetests/boards_and_blocks.go | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/server/services/store/sqlstore/boards_and_blocks.go b/server/services/store/sqlstore/boards_and_blocks.go index d8d67fd7b..31b2de187 100644 --- a/server/services/store/sqlstore/boards_and_blocks.go +++ b/server/services/store/sqlstore/boards_and_blocks.go @@ -151,6 +151,7 @@ func (s *SQLStore) duplicateBoard(db sq.BaseRunner, boardID string, userID strin board.Type = "P" board.IsTemplate = asTemplate board.CreatedBy = userID + board.ChannelID = "" if toTeam != "" { board.TeamID = toTeam diff --git a/server/services/store/storetests/boards_and_blocks.go b/server/services/store/storetests/boards_and_blocks.go index 05fe42135..927d33853 100644 --- a/server/services/store/storetests/boards_and_blocks.go +++ b/server/services/store/storetests/boards_and_blocks.go @@ -582,7 +582,7 @@ func testDuplicateBoard(t *testing.T, store store.Store) { newBab := &model.BoardsAndBlocks{ Boards: []*model.Board{ - {ID: "board-id-1", TeamID: teamID, Type: model.BoardTypeOpen}, + {ID: "board-id-1", TeamID: teamID, Type: model.BoardTypeOpen, ChannelID: "test-channel"}, {ID: "board-id-2", TeamID: teamID, Type: model.BoardTypePrivate}, {ID: "board-id-3", TeamID: teamID, Type: model.BoardTypeOpen}, }, @@ -606,6 +606,7 @@ func testDuplicateBoard(t *testing.T, store store.Store) { require.Len(t, bab.Boards, 1) require.Len(t, bab.Blocks, 1) require.Equal(t, bab.Boards[0].IsTemplate, false) + require.Equal(t, "", bab.Boards[0].ChannelID) }) t.Run("duplicate existing board as template", func(t *testing.T) { @@ -615,6 +616,7 @@ func testDuplicateBoard(t *testing.T, store store.Store) { require.Len(t, bab.Boards, 1) require.Len(t, bab.Blocks, 1) require.Equal(t, bab.Boards[0].IsTemplate, true) + require.Equal(t, "", bab.Boards[0].ChannelID) }) t.Run("duplicate not existing board", func(t *testing.T) {