summaryrefslogtreecommitdiff
path: root/internal/api/activitypub/users/outboxget.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2024-06-11 11:54:59 +0200
committerLibravatar GitHub <noreply@github.com>2024-06-11 11:54:59 +0200
commit611f9de39b7a29e89616c9ffe76d2aca1194877b (patch)
treec5792f5c4c21070b608e0bb3b743edffbd190074 /internal/api/activitypub/users/outboxget.go
parent[bugfix] boost and account recursion (#2982) (diff)
downloadgotosocial-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/api/activitypub/users/outboxget.go')
-rw-r--r--internal/api/activitypub/users/outboxget.go34
1 files changed, 10 insertions, 24 deletions
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