diff options
Diffstat (limited to 'views/outbox.go')
-rw-r--r-- | views/outbox.go | 48 |
1 files changed, 9 insertions, 39 deletions
diff --git a/views/outbox.go b/views/outbox.go index 4dd5ab5..c2b8015 100644 --- a/views/outbox.go +++ b/views/outbox.go @@ -11,15 +11,15 @@ import ( // RenderOutboxCollection takes a page of ActivityStream objects as JSON strings and concatenates them together to return an // ActivtyStreamsOrderedCollection func RenderOutboxCollection(name, domain string, page []models.OutboxItem) (map[string]interface{}, error) { - id, err := urls.UrlOutboxPage(name, domain) + id, err := urls.UrlOutbox(name, domain) if err != nil { return nil, err } - partOf, err := urls.UrlOutbox(name, domain) - if err != nil { - return nil, err - } + // partOf, err := urls.UrlOutbox(name, domain) + // if err != nil { + // return nil, err + // } publicUrl, err := url.Parse("https://www.w3.org/ns/activitystreams#Public") if err != nil { return nil, err @@ -27,16 +27,12 @@ func RenderOutboxCollection(name, domain string, page []models.OutboxItem) (map[ toProp := streams.NewActivityStreamsToProperty() toProp.AppendIRI(publicUrl) - oc := streams.NewActivityStreamsOrderedCollectionPage() + oc := streams.NewActivityStreamsOrderedCollection() idProp := streams.NewJSONLDIdProperty() idProp.Set(id) oc.SetJSONLDId(idProp) - partOfProp := streams.NewActivityStreamsPartOfProperty() - partOfProp.SetIRI(partOf) - oc.SetActivityStreamsPartOf(partOfProp) - itemsProp := streams.NewActivityStreamsOrderedItemsProperty() for _, v := range page { @@ -52,35 +48,9 @@ func RenderOutboxCollection(name, domain string, page []models.OutboxItem) (map[ itemsProp.AppendActivityStreamsCreate(crea) } + totalProp := streams.NewActivityStreamsTotalItemsProperty() + totalProp.Set(20) + oc.SetActivityStreamsTotalItems(totalProp) oc.SetActivityStreamsOrderedItems(itemsProp) return streams.Serialize(oc) } - -func RenderOutbox(name, domain string, totalItems int) (map[string]interface{}, error) { - id, err := urls.UrlOutbox(name, domain) - - if err != nil { - return nil, err - } - - first, err := urls.UrlOutboxPage(name, domain) - if err != nil { - return nil, err - } - - oc := streams.NewActivityStreamsOrderedCollection() - - idProp := streams.NewJSONLDIdProperty() - idProp.Set(id) - oc.SetJSONLDId(idProp) - - itemsProp := streams.NewActivityStreamsTotalItemsProperty() - itemsProp.Set(totalItems) - oc.SetActivityStreamsTotalItems(itemsProp) - - ocProp := streams.NewActivityStreamsFirstProperty() - ocProp.SetIRI(first) - oc.SetActivityStreamsFirst(ocProp) - - return streams.Serialize(oc) -} |