summaryrefslogtreecommitdiff
path: root/internal/typeutils
diff options
context:
space:
mode:
Diffstat (limited to 'internal/typeutils')
-rw-r--r--internal/typeutils/internaltoas.go33
-rw-r--r--internal/typeutils/internaltoas_test.go21
2 files changed, 0 insertions, 54 deletions
diff --git a/internal/typeutils/internaltoas.go b/internal/typeutils/internaltoas.go
index a795541d0..2fb782029 100644
--- a/internal/typeutils/internaltoas.go
+++ b/internal/typeutils/internaltoas.go
@@ -1560,39 +1560,6 @@ func (c *Converter) StatusesToASOutboxPage(ctx context.Context, outboxID string,
return page, nil
}
-// OutboxToASCollection returns an ordered collection with appropriate id, next, and last fields.
-// The returned collection won't have any actual entries; just links to where entries can be obtained.
-// we want something that looks like this:
-//
-// {
-// "@context": "https://www.w3.org/ns/activitystreams",
-// "id": "https://example.org/users/whatever/outbox",
-// "type": "OrderedCollection",
-// "first": "https://example.org/users/whatever/outbox?page=true"
-// }
-func (c *Converter) OutboxToASCollection(ctx context.Context, outboxID string) (vocab.ActivityStreamsOrderedCollection, error) {
- collection := streams.NewActivityStreamsOrderedCollection()
-
- collectionIDProp := streams.NewJSONLDIdProperty()
- outboxIDURI, err := url.Parse(outboxID)
- if err != nil {
- return nil, fmt.Errorf("error parsing url %s", outboxID)
- }
- collectionIDProp.SetIRI(outboxIDURI)
- collection.SetJSONLDId(collectionIDProp)
-
- collectionFirstProp := streams.NewActivityStreamsFirstProperty()
- collectionFirstPropID := fmt.Sprintf("%s?page=true", outboxID)
- collectionFirstPropIDURI, err := url.Parse(collectionFirstPropID)
- if err != nil {
- return nil, fmt.Errorf("error parsing url %s", collectionFirstPropID)
- }
- collectionFirstProp.SetIRI(collectionFirstPropIDURI)
- collection.SetActivityStreamsFirst(collectionFirstProp)
-
- return collection, nil
-}
-
// StatusesToASFeaturedCollection converts a slice of statuses into an ordered collection
// of URIs, suitable for serializing and serving via the activitypub API.
func (c *Converter) StatusesToASFeaturedCollection(ctx context.Context, featuredCollectionID string, statuses []*gtsmodel.Status) (vocab.ActivityStreamsOrderedCollection, error) {
diff --git a/internal/typeutils/internaltoas_test.go b/internal/typeutils/internaltoas_test.go
index 740938220..26e86c516 100644
--- a/internal/typeutils/internaltoas_test.go
+++ b/internal/typeutils/internaltoas_test.go
@@ -366,27 +366,6 @@ func (suite *InternalToASTestSuite) TestAccountToASWithSharedInbox() {
}`, trimmed)
}
-func (suite *InternalToASTestSuite) TestOutboxToASCollection() {
- testAccount := suite.testAccounts["admin_account"]
- ctx := context.Background()
-
- collection, err := suite.typeconverter.OutboxToASCollection(ctx, testAccount.OutboxURI)
- suite.NoError(err)
-
- ser, err := ap.Serialize(collection)
- suite.NoError(err)
-
- bytes, err := json.MarshalIndent(ser, "", " ")
- suite.NoError(err)
-
- suite.Equal(`{
- "@context": "https://www.w3.org/ns/activitystreams",
- "first": "http://localhost:8080/users/admin/outbox?page=true",
- "id": "http://localhost:8080/users/admin/outbox",
- "type": "OrderedCollection"
-}`, string(bytes))
-}
-
func (suite *InternalToASTestSuite) TestStatusToAS() {
testStatus := suite.testStatuses["local_account_1_status_1"]
ctx := context.Background()