mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-12 10:40:55 +09:00
GO-3034: fix
Signed-off-by: AnastasiaShemyakinskaya <shem98a@mail.ru>
This commit is contained in:
parent
daea0e30dc
commit
8d089bc6e5
3 changed files with 1700 additions and 765 deletions
|
@ -353,9 +353,6 @@ func (h *history) getChangedBlockIds(changeList []*pb.ChangeContent) []string {
|
|||
blocksIds = append(blocksIds, bl.Id)
|
||||
}
|
||||
}
|
||||
if c := content.GetBlockMove(); c != nil {
|
||||
blocksIds = append(blocksIds, c.Ids...)
|
||||
}
|
||||
if c := content.GetBlockUpdate(); c != nil {
|
||||
for _, event := range c.Events {
|
||||
blocksIds = h.handleAddEvent(event, blocksIds)
|
||||
|
@ -383,9 +380,6 @@ func (h *history) handleBlockSettingsEvents(event *pb.EventMessage, blockId []st
|
|||
if setAlign := event.GetBlockSetAlign(); setAlign != nil {
|
||||
blockId = append(blockId, setAlign.Id)
|
||||
}
|
||||
if setChildrenIds := event.GetBlockSetChildrenIds(); setChildrenIds != nil {
|
||||
blockId = append(blockId, setChildrenIds.Id)
|
||||
}
|
||||
if setBackgroundColor := event.GetBlockSetBackgroundColor(); setBackgroundColor != nil {
|
||||
blockId = append(blockId, setBackgroundColor.Id)
|
||||
}
|
||||
|
|
|
@ -271,31 +271,7 @@ func TestHistory_GetBlocksParticipants(t *testing.T) {
|
|||
|
||||
// then
|
||||
assert.Nil(t, err)
|
||||
assert.Len(t, blocksParticipants, 5)
|
||||
})
|
||||
t.Run("object with moved block changes by 1 participant", func(t *testing.T) {
|
||||
// given
|
||||
bl := &model.Block{Id: blockId, Content: &model.BlockContentOfText{Text: &model.BlockContentText{}}}
|
||||
keys, _ := accountdata.NewRandom()
|
||||
account := keys.SignKey.GetPublic()
|
||||
expectedChanges := []*objecttree.Change{
|
||||
provideBlockCreateChange(bl, account),
|
||||
provideBlockMoveChange(bl, account),
|
||||
}
|
||||
|
||||
// when
|
||||
history := newFixture(t, expectedChanges, objectId, spaceID, versionId)
|
||||
participantId := domain.NewParticipantId(spaceID, keys.SignKey.GetPublic().Account())
|
||||
blocksParticipants, err := history.GetBlocksParticipants(domain.FullID{
|
||||
ObjectID: objectId,
|
||||
SpaceID: spaceID,
|
||||
}, versionId, []*model.Block{bl})
|
||||
|
||||
// then
|
||||
assert.Nil(t, err)
|
||||
assert.Len(t, blocksParticipants, 1)
|
||||
assert.Equal(t, bl.Id, blocksParticipants[0].BlockId)
|
||||
assert.Equal(t, participantId, blocksParticipants[0].ParticipantId)
|
||||
assert.Len(t, blocksParticipants, 4)
|
||||
})
|
||||
t.Run("object block was deleted, don't add it in response", func(t *testing.T) {
|
||||
bl := &model.Block{Id: blockId, Content: &model.BlockContentOfText{Text: &model.BlockContentText{}}}
|
||||
|
@ -1166,23 +1142,6 @@ func provideBlockFieldChange(block *model.Block, account crypto.PubKey) *objectt
|
|||
}
|
||||
}
|
||||
|
||||
func provideBlockMoveChange(block *model.Block, account crypto.PubKey) *objecttree.Change {
|
||||
return &objecttree.Change{
|
||||
Identity: account,
|
||||
Model: &pb.Change{
|
||||
Content: []*pb.ChangeContent{
|
||||
{
|
||||
Value: &pb.ChangeContentValueOfBlockMove{
|
||||
BlockMove: &pb.ChangeBlockMove{
|
||||
Ids: []string{block.Id},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func provideBlockRemoveChange(blockId string, account crypto.PubKey) *objecttree.Change {
|
||||
return &objecttree.Change{
|
||||
Identity: account,
|
||||
|
|
2416
pb/commands.pb.go
2416
pb/commands.pb.go
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue