mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-09 17:44:59 +09:00
HasObjectType -> HasObjectTypeByKey
This commit is contained in:
parent
4a3b7a0daa
commit
b7e745e9e1
4 changed files with 6 additions and 7 deletions
|
@ -100,7 +100,7 @@ func validateObjectDetails(s *pb.ChangeSnapshot, info *useCaseInfo) error {
|
|||
vals := pbtypes.GetStringListValue(v)
|
||||
for _, val := range vals {
|
||||
if bundle.HasRelation(strings.TrimPrefix(val, addr.RelationKeyToIdPrefix)) ||
|
||||
bundle.HasObjectType(strings.TrimPrefix(val, addr.ObjectTypeKeyToIdPrefix)) || val == addr.AnytypeProfileId {
|
||||
bundle.HasObjectTypeByKey(bundle.TypeKey(strings.TrimPrefix(val, addr.ObjectTypeKeyToIdPrefix))) || val == addr.AnytypeProfileId {
|
||||
continue
|
||||
}
|
||||
_, found := info.ids[val]
|
||||
|
@ -120,7 +120,7 @@ func validateObjectCustomTypes(s *pb.ChangeSnapshot, info *useCaseInfo) error {
|
|||
id := pbtypes.GetString(s.Data.Details, bundle.RelationKeyId.String())
|
||||
customObjectFound := false
|
||||
for _, ot := range s.Data.ObjectTypes {
|
||||
if !bundle.HasObjectType(strings.TrimPrefix(ot, addr.ObjectTypeKeyToIdPrefix)) {
|
||||
if !bundle.HasObjectTypeByKey(bundle.TypeKey(strings.TrimPrefix(ot, addr.ObjectTypeKeyToIdPrefix))) {
|
||||
customObjectFound = true
|
||||
fmt.Printf("object '%s' contains unknown object type: %s\n", id, ot)
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ func handleLinkBlock(oldIDtoNew map[string]string, block simple.Block, st *state
|
|||
|
||||
func isBundledObjects(targetObjectID string) bool {
|
||||
ot, err := bundle.TypeKeyFromUrl(targetObjectID)
|
||||
if err == nil && bundle.HasObjectType(ot.String()) {
|
||||
if err == nil && bundle.HasObjectTypeByKey(ot) {
|
||||
return true
|
||||
}
|
||||
rel, err := pbtypes.RelationIdToKey(targetObjectID)
|
||||
|
|
|
@ -172,7 +172,7 @@ func (oc *ObjectCreator) installBundledRelationsAndTypes(
|
|||
}
|
||||
|
||||
for _, typeKey := range objectTypeKeys {
|
||||
if !bundle.HasObjectType(string(typeKey)) {
|
||||
if !bundle.HasObjectTypeByKey(typeKey) {
|
||||
continue
|
||||
}
|
||||
// TODO: check if we have them in oldIDtoNew
|
||||
|
|
|
@ -188,9 +188,8 @@ func HasRelation(key string) bool {
|
|||
return exists
|
||||
}
|
||||
|
||||
// TODO TypeKey param
|
||||
func HasObjectType(key string) bool {
|
||||
_, exists := types[TypeKey(key)]
|
||||
func HasObjectTypeByKey(key TypeKey) bool {
|
||||
_, exists := types[key]
|
||||
|
||||
return exists
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue