mirror of
https://github.com/mattermost/focalboard.git
synced 2024-12-21 13:38:56 +02:00
Remove BoardID field from BlockPatch, ensuring patching a block cannot change boardID (#3719)
This commit is contained in:
parent
67cec5de4f
commit
a91e1f1758
@ -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
|
||||
}
|
||||
|
@ -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},
|
||||
|
@ -13,7 +13,6 @@ type ContentBlockTypes = typeof contentBlockTypes[number]
|
||||
type BlockTypes = typeof blockTypes[number]
|
||||
|
||||
interface BlockPatch {
|
||||
boardId?: string
|
||||
parentId?: string
|
||||
schema?: number
|
||||
type?: BlockTypes
|
||||
|
Loading…
Reference in New Issue
Block a user