From 3e9219ab0ffb4065e695c5506279dc2ef101fd90 Mon Sep 17 00:00:00 2001 From: Scott Bishel Date: Mon, 20 Jun 2022 14:16:02 -0600 Subject: [PATCH] GH-3050 - Fix deleting empty property (#3249) * remove check for blocks on patch, a delete may not have blocks * remove no longer necessary tests Co-authored-by: Mattermod --- server/integrationtests/boards_and_blocks_test.go | 10 ---------- server/model/boards_and_blocks.go | 8 -------- server/model/boards_and_blocks_test.go | 13 ------------- 3 files changed, 31 deletions(-) diff --git a/server/integrationtests/boards_and_blocks_test.go b/server/integrationtests/boards_and_blocks_test.go index f0079dd5d..739818811 100644 --- a/server/integrationtests/boards_and_blocks_test.go +++ b/server/integrationtests/boards_and_blocks_test.go @@ -693,16 +693,6 @@ func TestDeleteBoardsAndBlocks(t *testing.T) { require.False(t, success) }) - t.Run("no blocks", func(t *testing.T) { - dbab := &model.DeleteBoardsAndBlocks{ - Boards: []string{board.ID}, - } - - success, resp := th.Client.DeleteBoardsAndBlocks(dbab) - th.CheckBadRequest(resp) - require.False(t, success) - }) - t.Run("boards from different teams", func(t *testing.T) { newOtherTeamsBoard := &model.Board{ TeamID: "another-team-id", diff --git a/server/model/boards_and_blocks.go b/server/model/boards_and_blocks.go index fecbc9dfc..377dd247e 100644 --- a/server/model/boards_and_blocks.go +++ b/server/model/boards_and_blocks.go @@ -94,10 +94,6 @@ func (dbab *DeleteBoardsAndBlocks) IsValid() error { return ErrNoBoardsInBoardsAndBlocks } - if len(dbab.Blocks) == 0 { - return ErrNoBlocksInBoardsAndBlocks - } - return nil } @@ -131,10 +127,6 @@ func (dbab *PatchBoardsAndBlocks) IsValid() error { return ErrBoardIDsAndPatchesMissmatchInBoardsAndBlocks } - if len(dbab.BlockIDs) == 0 { - return ErrNoBlocksInBoardsAndBlocks - } - if len(dbab.BlockIDs) != len(dbab.BlockPatches) { return ErrBlockIDsAndPatchesMissmatchInBoardsAndBlocks } diff --git a/server/model/boards_and_blocks_test.go b/server/model/boards_and_blocks_test.go index 1a8c01a8a..ae1815ce4 100644 --- a/server/model/boards_and_blocks_test.go +++ b/server/model/boards_and_blocks_test.go @@ -183,19 +183,6 @@ func TestIsValidPatchBoardsAndBlocks(t *testing.T) { require.ErrorIs(t, pbab.IsValid(), ErrBoardIDsAndPatchesMissmatchInBoardsAndBlocks) }) - t.Run("no block ids", func(t *testing.T) { - pbab := &PatchBoardsAndBlocks{ - BoardIDs: []string{"board-id-1", "board-id-2"}, - BoardPatches: []*BoardPatch{ - {Title: &newTitle}, - {Description: &newDescription}, - }, - BlockIDs: []string{}, - } - - require.ErrorIs(t, pbab.IsValid(), ErrNoBlocksInBoardsAndBlocks) - }) - t.Run("missmatch block IDs and patches", func(t *testing.T) { pbab := &PatchBoardsAndBlocks{ BoardIDs: []string{"board-id-1", "board-id-2"},