Using new storage package which allows an IRI to be used as an filter for LoadObject
This commit is contained in:
parent
e77b3d5fe7
commit
fad811cef1
2
go.mod
2
go.mod
|
@ -6,5 +6,5 @@ require (
|
||||||
github.com/go-ap/activitystreams v0.0.0-20190621152349-7d4dd99336d5
|
github.com/go-ap/activitystreams v0.0.0-20190621152349-7d4dd99336d5
|
||||||
github.com/go-ap/errors v0.0.0-20190621154420-19e59a62cbd5
|
github.com/go-ap/errors v0.0.0-20190621154420-19e59a62cbd5
|
||||||
github.com/go-ap/jsonld v0.0.0-20190630153951-3e340483bd9f
|
github.com/go-ap/jsonld v0.0.0-20190630153951-3e340483bd9f
|
||||||
github.com/go-ap/storage v0.0.0-20190621154542-2d70b6c181c4
|
github.com/go-ap/storage v0.0.0-20190630174915-381f9e8bdbb8
|
||||||
)
|
)
|
||||||
|
|
|
@ -81,9 +81,15 @@ func (a ActivityHandlerFn) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
errors.HandleError(err).ServeHTTP(w, r)
|
errors.HandleError(err).ServeHTTP(w, r)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
contentType := json.ContentType
|
contentType := json.ContentType
|
||||||
if act, err := as.ToActivity(it); err == nil {
|
if act, err := as.ToActivity(it); err == nil {
|
||||||
|
if len(it.GetType()) == 0 && len(it.GetLink()) > 0 {
|
||||||
|
col, cnt, err := st.LoadObjects(it)
|
||||||
|
if err == nil && cnt == 1 {
|
||||||
|
act.Object = col[0]
|
||||||
|
}
|
||||||
|
}
|
||||||
if dat, err = json.Marshal(act.Object); err != nil {
|
if dat, err = json.Marshal(act.Object); err != nil {
|
||||||
dat = dat[:]
|
dat = dat[:]
|
||||||
contentType = "application/json"
|
contentType = "application/json"
|
||||||
|
|
Reference in a new issue