From 611f9de39b7a29e89616c9ffe76d2aca1194877b Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Tue, 11 Jun 2024 11:54:59 +0200 Subject: [bugfix] Deref stats async, serve stub collections if handshaking (#2990) * [bugfix] Deref stats async, allow peek if handshaking * don't return totalItems when handshaking or hiding collections * use GetLimit() * use StubAccountStats --- internal/api/activitypub/users/outboxget.go | 34 +++++++++-------------------- 1 file changed, 10 insertions(+), 24 deletions(-) (limited to 'internal/api/activitypub/users/outboxget.go') diff --git a/internal/api/activitypub/users/outboxget.go b/internal/api/activitypub/users/outboxget.go index 7dcc354ac..43379ad8f 100644 --- a/internal/api/activitypub/users/outboxget.go +++ b/internal/api/activitypub/users/outboxget.go @@ -19,14 +19,13 @@ package users import ( "errors" - "fmt" "net/http" - "strconv" "strings" "github.com/gin-gonic/gin" apiutil "github.com/superseriousbusiness/gotosocial/internal/api/util" "github.com/superseriousbusiness/gotosocial/internal/gtserror" + "github.com/superseriousbusiness/gotosocial/internal/paging" ) // OutboxGETHandler swagger:operation GET /users/{username}/outbox s2sOutboxGet @@ -105,30 +104,17 @@ func (m *Module) OutboxGETHandler(c *gin.Context) { return } - var page bool - if pageString := c.Query(PageKey); pageString != "" { - i, err := strconv.ParseBool(pageString) - if err != nil { - err := fmt.Errorf("error parsing %s: %s", PageKey, err) - apiutil.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGetV1) - return - } - page = i - } - - minID := "" - minIDString := c.Query(MinIDKey) - if minIDString != "" { - minID = minIDString - } - - maxID := "" - maxIDString := c.Query(MaxIDKey) - if maxIDString != "" { - maxID = maxIDString + page, errWithCode := paging.ParseIDPage(c, + 1, // min limit + 80, // max limit + 0, // default = disabled + ) + if errWithCode != nil { + apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1) + return } - resp, errWithCode := m.processor.Fedi().OutboxGet(c.Request.Context(), requestedUsername, page, maxID, minID) + resp, errWithCode := m.processor.Fedi().OutboxGet(c.Request.Context(), requestedUsername, page) if errWithCode != nil { apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1) return -- cgit v1.2.3