diff options
author | 2024-06-11 11:54:59 +0200 | |
---|---|---|
committer | 2024-06-11 11:54:59 +0200 | |
commit | 611f9de39b7a29e89616c9ffe76d2aca1194877b (patch) | |
tree | c5792f5c4c21070b608e0bb3b743edffbd190074 /internal/ap/collections.go | |
parent | [bugfix] boost and account recursion (#2982) (diff) | |
download | gotosocial-611f9de39b7a29e89616c9ffe76d2aca1194877b.tar.xz |
[bugfix] Deref stats async, serve stub collections if handshaking (#2990)v0.16.0-rc2
* [bugfix] Deref stats async, allow peek if handshaking
* don't return totalItems when handshaking or hiding collections
* use GetLimit()
* use StubAccountStats
Diffstat (limited to 'internal/ap/collections.go')
-rw-r--r-- | internal/ap/collections.go | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/internal/ap/collections.go b/internal/ap/collections.go index 62c81fd57..43b7541e4 100644 --- a/internal/ap/collections.go +++ b/internal/ap/collections.go @@ -321,7 +321,8 @@ type CollectionParams struct { Query url.Values // Total no. items. - Total int + // Omitted if nil. + Total *int } type CollectionPageParams struct { @@ -367,6 +368,7 @@ type CollectionPageBuilder interface { // vocab.ActivityStreamsOrderedItemsProperty type ItemsPropertyBuilder interface { AppendIRI(*url.URL) + AppendActivityStreamsCreate(vocab.ActivityStreamsCreate) // NOTE: add more of the items-property-like interface // functions here as you require them for building pages. @@ -409,9 +411,11 @@ func buildCollection[C CollectionBuilder](collection C, params CollectionParams) collection.SetJSONLDId(idProp) // Add the collection totalItems count property. - totalItems := streams.NewActivityStreamsTotalItemsProperty() - totalItems.Set(params.Total) - collection.SetActivityStreamsTotalItems(totalItems) + if params.Total != nil { + totalItems := streams.NewActivityStreamsTotalItemsProperty() + totalItems.Set(*params.Total) + collection.SetActivityStreamsTotalItems(totalItems) + } // No First page means we're done. if params.First == nil { @@ -497,9 +501,11 @@ func buildCollectionPage[C CollectionPageBuilder, I ItemsPropertyBuilder](collec } // Add the collection totalItems count property. - totalItems := streams.NewActivityStreamsTotalItemsProperty() - totalItems.Set(params.Total) - collectionPage.SetActivityStreamsTotalItems(totalItems) + if params.Total != nil { + totalItems := streams.NewActivityStreamsTotalItemsProperty() + totalItems.Set(*params.Total) + collectionPage.SetActivityStreamsTotalItems(totalItems) + } if params.Append == nil { // nil check outside the for loop. |