diff options
author | 2024-06-18 18:18:00 +0200 | |
---|---|---|
committer | 2024-06-18 18:18:00 +0200 | |
commit | d2b3d37724a999d4cc78c46157593267e29d184e (patch) | |
tree | ac72be127d8adb80bbd756ad970ae14df7b5618f /internal/api/client/admin/emojisget.go | |
parent | [feature] Implement types[] param for notifications (#3009) (diff) | |
download | gotosocial-d2b3d37724a999d4cc78c46157593267e29d184e.tar.xz |
[feature/frontend] Reports frontend v2 (#3022)
* use apiutil + paging in admin processor+handlers
* we're making it happen
* fix little whoopsie
* styling for report list
* don't youuuu forget about meee don't don't don't don't
* last bits
* sanitize content before showing in report statuses
* update report docs
Diffstat (limited to 'internal/api/client/admin/emojisget.go')
-rw-r--r-- | internal/api/client/admin/emojisget.go | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/internal/api/client/admin/emojisget.go b/internal/api/client/admin/emojisget.go index 4013e1836..d50b553ac 100644 --- a/internal/api/client/admin/emojisget.go +++ b/internal/api/client/admin/emojisget.go @@ -20,7 +20,6 @@ package admin import ( "fmt" "net/http" - "strconv" "strings" "github.com/gin-gonic/gin" @@ -76,6 +75,8 @@ import ( // type: integer // description: Number of emojis to return. Less than 1, or not set, means unlimited (all emojis). // default: 50 +// minimum: 0 +// maximum: 200 // in: query // - // name: max_shortcode_domain @@ -142,19 +143,10 @@ func (m *Module) EmojisGETHandler(c *gin.Context) { maxShortcodeDomain := c.Query(MaxShortcodeDomainKey) minShortcodeDomain := c.Query(MinShortcodeDomainKey) - limit := 50 - limitString := c.Query(LimitKey) - if limitString != "" { - i, err := strconv.ParseInt(limitString, 10, 32) - if err != nil { - err := fmt.Errorf("error parsing %s: %s", LimitKey, err) - apiutil.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGetV1) - return - } - limit = int(i) - } - if limit < 0 { - limit = 0 + limit, errWithCode := apiutil.ParseLimit(c.Query(apiutil.LimitKey), 50, 200, 0) + if errWithCode != nil { + apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1) + return } var domain string |