[bugfix] Always serialize orderedItems as array (#1673)

This commit is contained in:
tobi 2023-04-06 13:16:53 +02:00 committed by GitHub
commit 4f322f527f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 77 additions and 7 deletions

View file

@ -26,6 +26,7 @@ import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/gotosocial/internal/ap"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/testrig"
@ -669,7 +670,7 @@ func (suite *InternalToASTestSuite) TestPinnedStatusesToASSomeItems() {
suite.FailNow(err.Error())
}
ser, err := streams.Serialize(collection)
ser, err := ap.SerializeOrderedCollection(collection)
suite.NoError(err)
bytes, err := json.MarshalIndent(ser, "", " ")
@ -701,7 +702,7 @@ func (suite *InternalToASTestSuite) TestPinnedStatusesToASNoItems() {
suite.FailNow(err.Error())
}
ser, err := streams.Serialize(collection)
ser, err := ap.SerializeOrderedCollection(collection)
suite.NoError(err)
bytes, err := json.MarshalIndent(ser, "", " ")
@ -730,7 +731,7 @@ func (suite *InternalToASTestSuite) TestPinnedStatusesToASOneItem() {
suite.FailNow(err.Error())
}
ser, err := streams.Serialize(collection)
ser, err := ap.SerializeOrderedCollection(collection)
suite.NoError(err)
bytes, err := json.MarshalIndent(ser, "", " ")
@ -739,7 +740,9 @@ func (suite *InternalToASTestSuite) TestPinnedStatusesToASOneItem() {
suite.Equal(`{
"@context": "https://www.w3.org/ns/activitystreams",
"id": "http://localhost:8080/users/1happyturtle/collections/featured",
"orderedItems": "http://localhost:8080/users/1happyturtle/statuses/01G20ZM733MGN8J344T4ZDDFY1",
"orderedItems": [
"http://localhost:8080/users/1happyturtle/statuses/01G20ZM733MGN8J344T4ZDDFY1"
],
"totalItems": 1,
"type": "OrderedCollection"
}`, string(bytes))