summaryrefslogtreecommitdiff
path: root/internal/api/client/admin/domainblocksget.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-07-07 11:34:12 +0200
committerLibravatar GitHub <noreply@github.com>2023-07-07 11:34:12 +0200
commite70bf8a6c82e3d5c943550b364fc6f8120f6f07e (patch)
treef408ccff2e6f2451bf95ee9a5d96e5b678d686d5 /internal/api/client/admin/domainblocksget.go
parent[chore/performance] Remove remaining 'whereEmptyOrNull' funcs (#1946) (diff)
downloadgotosocial-e70bf8a6c82e3d5c943550b364fc6f8120f6f07e.tar.xz
[chore/bugfix] Domain block tidying up, Implement first pass of `207 Multi-Status` (#1886)
* [chore/refactor] update domain block processing * expose domain block import errors a lil better * move/remove unused query keys
Diffstat (limited to 'internal/api/client/admin/domainblocksget.go')
-rw-r--r--internal/api/client/admin/domainblocksget.go15
1 files changed, 4 insertions, 11 deletions
diff --git a/internal/api/client/admin/domainblocksget.go b/internal/api/client/admin/domainblocksget.go
index d641fc0e1..68947f471 100644
--- a/internal/api/client/admin/domainblocksget.go
+++ b/internal/api/client/admin/domainblocksget.go
@@ -20,7 +20,6 @@ package admin
import (
"fmt"
"net/http"
- "strconv"
"github.com/gin-gonic/gin"
apiutil "github.com/superseriousbusiness/gotosocial/internal/api/util"
@@ -92,16 +91,10 @@ func (m *Module) DomainBlocksGETHandler(c *gin.Context) {
return
}
- export := false
- exportString := c.Query(ExportQueryKey)
- if exportString != "" {
- i, err := strconv.ParseBool(exportString)
- if err != nil {
- err := fmt.Errorf("error parsing %s: %s", ExportQueryKey, err)
- apiutil.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGetV1)
- return
- }
- export = i
+ export, errWithCode := apiutil.ParseDomainBlockExport(c.Query(apiutil.DomainBlockExportKey), false)
+ if errWithCode != nil {
+ apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
+ return
}
domainBlocks, errWithCode := m.processor.Admin().DomainBlocksGet(c.Request.Context(), authed.Account, export)