Use generic Object and Actor AP types for returning local Object and Actor struct type

This commit is contained in:
Marius Orcsik 2019-09-24 10:03:35 +03:00
parent 61e8d43a6c
commit 0ff0c8c86f
No known key found for this signature in database
GPG key ID: 889CE8E4FB2D877A

View file

@ -6,10 +6,12 @@ import (
)
func JSONGetItemByType(typ as.ActivityVocabularyType) (as.Item, error) {
if as.ObjectTypes.Contains(typ) {
obTyp := as.ActivityVocabularyTypes{as.ObjectType,}
if as.ObjectTypes.Contains(typ) || obTyp.Contains(typ) {
return &Object{Parent: Parent{Type: typ}}, nil
}
if as.ActorTypes.Contains(typ) {
actTyp := as.ActivityVocabularyTypes{as.ActorType,}
if as.ActorTypes.Contains(typ) || actTyp.Contains(typ) {
return &actor{Parent: Parent{Type: typ}}, nil
}
return as.JSONGetItemByType(typ)