From a91e1f1758c8744e88b328b5920ba9cb4dead989 Mon Sep 17 00:00:00 2001 From: Doug Lauder Date: Mon, 22 Aug 2022 15:57:22 -0400 Subject: [PATCH] Remove BoardID field from BlockPatch, ensuring patching a block cannot change boardID (#3719) --- server/model/block.go | 8 -------- server/services/store/storetests/blocks.go | 14 -------------- webapp/src/blocks/block.ts | 1 - 3 files changed, 23 deletions(-) diff --git a/server/model/block.go b/server/model/block.go index 3bdd9eab7..d4048e115 100644 --- a/server/model/block.go +++ b/server/model/block.go @@ -94,10 +94,6 @@ type BlockPatch struct { // The block removed fields // required: false DeletedFields []string `json:"deletedFields"` - - // The board id that the block belongs to - // required: false - BoardID *string `json:"boardId"` } // BlockPatchBatch is a batch of IDs and patches for modify blocks @@ -149,10 +145,6 @@ func (p *BlockPatch) Patch(block *Block) *Block { block.ParentID = *p.ParentID } - if p.BoardID != nil { - block.BoardID = *p.BoardID - } - if p.Schema != nil { block.Schema = *p.Schema } diff --git a/server/services/store/storetests/blocks.go b/server/services/store/storetests/blocks.go index ace1e8b5a..e18005299 100644 --- a/server/services/store/storetests/blocks.go +++ b/server/services/store/storetests/blocks.go @@ -266,20 +266,6 @@ func testPatchBlock(t *testing.T, store store.Store) { require.Len(t, blocks, initialCount) }) - t.Run("invalid rootid", func(t *testing.T) { - wrongBoardID := "" - blockPatch := model.BlockPatch{ - BoardID: &wrongBoardID, - } - - err := store.PatchBlock("id-test", &blockPatch, "user-id-1") - require.Error(t, err) - - blocks, err := store.GetBlocksForBoard(boardID) - require.NoError(t, err) - require.Len(t, blocks, initialCount) - }) - t.Run("invalid fields data", func(t *testing.T) { blockPatch := model.BlockPatch{ UpdatedFields: map[string]interface{}{"no-serialiable-value": t.Run}, diff --git a/webapp/src/blocks/block.ts b/webapp/src/blocks/block.ts index 4105996bc..1c274fbea 100644 --- a/webapp/src/blocks/block.ts +++ b/webapp/src/blocks/block.ts @@ -13,7 +13,6 @@ type ContentBlockTypes = typeof contentBlockTypes[number] type BlockTypes = typeof blockTypes[number] interface BlockPatch { - boardId?: string parentId?: string schema?: number type?: BlockTypes