1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-09 09:35:00 +09:00

Merge pull request #2208 from anyproto/go-5193-support-new-layouts-add-type-to-snapshot-resolve-layout

GO-5193: support new layouts add type to snapshot resolve layout
This commit is contained in:
Anastasia Shemyakinskaya 2025-03-10 11:10:00 +01:00 committed by GitHub
commit 9db4a9bcb6
Signed by: github
GPG key ID: B5690EEEBB952194
3 changed files with 13 additions and 3 deletions

View file

@ -734,7 +734,7 @@ func (e *exportContext) getRelationsFromStore(relations []string) ([]database.Re
func (e *exportContext) addRelation(relation database.Record) {
relationKey := domain.RelationKey(relation.Details.GetString(bundle.RelationKeyRelationKey))
if relationKey != "" && !bundle.HasRelation(relationKey) {
if relationKey != "" {
id := relation.Details.GetString(bundle.RelationKeyId)
e.docs[id] = &Doc{Details: relation.Details, isLink: e.isLinkProcess}
}

View file

@ -1690,7 +1690,7 @@ func Test_docsForExport(t *testing.T) {
// then
assert.Nil(t, err)
assert.Equal(t, 3, len(expCtx.docs))
assert.Equal(t, 4, len(expCtx.docs))
})
t.Run("objects without file", func(t *testing.T) {
// given

View file

@ -13,6 +13,7 @@ var allObjectsRelationsWhiteList = []string{
bundle.RelationKeySpaceId.String(),
bundle.RelationKeyId.String(),
bundle.RelationKeyLayout.String(),
bundle.RelationKeyResolvedLayout.String(),
bundle.RelationKeyIsArchived.String(),
bundle.RelationKeyIsDeleted.String(),
bundle.RelationKeyName.String(),
@ -39,6 +40,15 @@ var derivedObjectsWhiteList = append(slices.Clone(allObjectsRelationsWhiteList),
var relationsWhiteList = append(slices.Clone(derivedObjectsWhiteList), bundle.RelationKeyRelationFormat.String())
var relationOptionWhiteList = append(slices.Clone(derivedObjectsWhiteList), bundle.RelationKeyRelationOptionColor.String())
var objectWhiteList = append(slices.Clone(derivedObjectsWhiteList),
bundle.RelationKeyRecommendedRelations.String(),
bundle.RelationKeyRecommendedFeaturedRelations.String(),
bundle.RelationKeyRecommendedLayout.String(),
bundle.RelationKeyLayoutWidth.String(),
bundle.RelationKeyLayoutAlign.String(),
bundle.RelationKeyIconName.String(),
bundle.RelationKeyIconOption.String(),
)
var fileRelationsWhiteList = append(
slices.Clone(documentRelationsWhiteList),
@ -60,7 +70,7 @@ var publishingRelationsWhiteList = map[model.ObjectTypeLayout][]string{
model.ObjectType_todo: todoRelationsWhiteList,
model.ObjectType_set: documentRelationsWhiteList,
model.ObjectType_collection: documentRelationsWhiteList,
model.ObjectType_objectType: derivedObjectsWhiteList,
model.ObjectType_objectType: objectWhiteList,
model.ObjectType_relation: relationsWhiteList,
model.ObjectType_file: fileRelationsWhiteList,
model.ObjectType_pdf: fileRelationsWhiteList,