diff --git a/core/block/object/objectcreator/installer.go b/core/block/object/objectcreator/installer.go index f22859e07..c51e13c8f 100644 --- a/core/block/object/objectcreator/installer.go +++ b/core/block/object/objectcreator/installer.go @@ -141,6 +141,21 @@ func (s *service) listInstalledObjects(space clientspace.Space, sourceObjectIds Condition: model.BlockContentDataviewFilter_In, Value: pbtypes.StringList(sourceObjectIds), }, + { + Operator: model.BlockContentDataviewFilter_Or, + NestedFilters: []*model.BlockContentDataviewFilter{ + { + RelationKey: bundle.RelationKeyLayout.String(), + Condition: model.BlockContentDataviewFilter_Equal, + Value: pbtypes.Int64(int64(model.ObjectType_objectType)), + }, + { + RelationKey: bundle.RelationKeyLayout.String(), + Condition: model.BlockContentDataviewFilter_Equal, + Value: pbtypes.Int64(int64(model.ObjectType_relation)), + }, + }, + }, }, }) if err != nil { @@ -270,6 +285,16 @@ func (s *service) queryDeletedObjects(space clientspace.Space, sourceObjectIDs [ return nil, err } return s.objectStore.SpaceIndex(space.Id()).QueryRaw(&database.Filters{FilterObj: database.FiltersAnd{ + database.FiltersOr{ + database.FilterEq{ + Key: bundle.RelationKeyLayout.String(), + Value: pbtypes.Int64(int64(model.ObjectType_objectType)), + }, + database.FilterEq{ + Key: bundle.RelationKeyLayout.String(), + Value: pbtypes.Int64(int64(model.ObjectType_relation)), + }, + }, database.FilterIn{ Key: bundle.RelationKeySourceObject.String(), Value: sourceList, diff --git a/core/block/object/objectcreator/installer_test.go b/core/block/object/objectcreator/installer_test.go index cecdbeee0..b9fa01a54 100644 --- a/core/block/object/objectcreator/installer_test.go +++ b/core/block/object/objectcreator/installer_test.go @@ -7,6 +7,7 @@ import ( "github.com/anyproto/anytype-heart/pkg/lib/bundle" "github.com/anyproto/anytype-heart/pkg/lib/localstore/objectstore" + "github.com/anyproto/anytype-heart/pkg/lib/pb/model" "github.com/anyproto/anytype-heart/space/clientspace/mock_clientspace" "github.com/anyproto/anytype-heart/util/pbtypes" ) @@ -48,6 +49,7 @@ func TestInstaller_queryDeletedObjects(t *testing.T) { bundle.RelationKeySourceObject: pbtypes.String(obj.key.BundledURL()), bundle.RelationKeyIsDeleted: pbtypes.Bool(obj.isDeleted), bundle.RelationKeyIsArchived: pbtypes.Bool(obj.isArchived), + bundle.RelationKeyLayout: pbtypes.Int64(int64(model.ObjectType_relation)), }}) sourceObjectIds = append(sourceObjectIds, obj.key.BundledURL()) if obj.spaceId == spaceId && (obj.isDeleted || obj.isArchived) {