1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-01-11 18:13:52 +02:00

Remove BoardID field from BlockPatch, ensuring patching a block cannot change boardID (#3719)

This commit is contained in:
Doug Lauder 2022-08-22 15:57:22 -04:00 committed by GitHub
parent 67cec5de4f
commit a91e1f1758
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 23 deletions

View File

@ -94,10 +94,6 @@ type BlockPatch struct {
// The block removed fields // The block removed fields
// required: false // required: false
DeletedFields []string `json:"deletedFields"` 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 // 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 block.ParentID = *p.ParentID
} }
if p.BoardID != nil {
block.BoardID = *p.BoardID
}
if p.Schema != nil { if p.Schema != nil {
block.Schema = *p.Schema block.Schema = *p.Schema
} }

View File

@ -266,20 +266,6 @@ func testPatchBlock(t *testing.T, store store.Store) {
require.Len(t, blocks, initialCount) 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) { t.Run("invalid fields data", func(t *testing.T) {
blockPatch := model.BlockPatch{ blockPatch := model.BlockPatch{
UpdatedFields: map[string]interface{}{"no-serialiable-value": t.Run}, UpdatedFields: map[string]interface{}{"no-serialiable-value": t.Run},

View File

@ -13,7 +13,6 @@ type ContentBlockTypes = typeof contentBlockTypes[number]
type BlockTypes = typeof blockTypes[number] type BlockTypes = typeof blockTypes[number]
interface BlockPatch { interface BlockPatch {
boardId?: string
parentId?: string parentId?: string
schema?: number schema?: number
type?: BlockTypes type?: BlockTypes