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

GO-3854: Fix types and layouts

This commit is contained in:
Sergey 2024-08-12 14:09:16 +02:00
parent 12672365a5
commit 1c1c01742b
No known key found for this signature in database
GPG key ID: 3B6BEF79160221C6
2 changed files with 11 additions and 2 deletions

View file

@ -18,6 +18,9 @@ import (
"github.com/anyproto/anytype-heart/core/block/editor/storestate"
"github.com/anyproto/anytype-heart/pb"
"github.com/anyproto/anytype-heart/pkg/lib/bundle"
coresb "github.com/anyproto/anytype-heart/pkg/lib/core/smartblock"
"github.com/anyproto/anytype-heart/pkg/lib/pb/model"
"github.com/anyproto/anytype-heart/util/pbtypes"
)
var _ updatelistener.UpdateListener = (*store)(nil)
@ -48,7 +51,13 @@ func (s *store) ReadDoc(ctx context.Context, receiver ChangeReceiver, empty bool
st := state.NewDoc(s.id, nil).(*state.State)
// Set object type here in order to derive value of Type relation in smartblock.Init
st.SetObjectTypeKey(bundle.TypeKeyChat)
if s.smartblockType == coresb.SmartBlockTypeChatObject {
st.SetObjectTypeKey(bundle.TypeKeyChat)
st.SetDetailAndBundledRelation(bundle.RelationKeyLayout, pbtypes.Int64(int64(model.ObjectType_chat)))
} else {
st.SetObjectTypeKey(bundle.TypeKeyChatDerived)
st.SetDetailAndBundledRelation(bundle.RelationKeyLayout, pbtypes.Int64(int64(model.ObjectType_chatDerived)))
}
return st, nil
}

View file

@ -69,7 +69,7 @@ func (mw *Middleware) addChat(cctx context.Context, objectId string) (string, er
chatDetails.Fields[bundle.RelationKeyUniqueKey.String()] = pbtypes.String(chatUniqueKey.Marshal())
chatReq := objectcreator.CreateObjectRequest{
ObjectTypeKey: bundle.TypeKeyChat,
ObjectTypeKey: bundle.TypeKeyChatDerived,
Details: chatDetails,
}