diff options
author | 2025-01-05 13:20:33 +0100 | |
---|---|---|
committer | 2025-01-05 13:20:33 +0100 | |
commit | e9bb7ddd3aa11da5c48a75c4a600f8fe5cc1c990 (patch) | |
tree | a2897775112a821aa093b6e2686044814912001f /internal/api/client/admin/domainpermissiondraftcreate.go | |
parent | [chore] Update robots.txt with more AI bots (#3634) (diff) | |
download | gotosocial-e9bb7ddd3aa11da5c48a75c4a600f8fe5cc1c990.tar.xz |
[feature] Create/update/remove domain permission subscriptions (#3623)
* [feature] Create/update/remove domain permission subscriptions
* lint
* envparsing
* remove errant fmt.Println
* create drafts, subs, exclude, from snapshot models
* name etag column correctly
* remove count column
* lint
Diffstat (limited to 'internal/api/client/admin/domainpermissiondraftcreate.go')
-rw-r--r-- | internal/api/client/admin/domainpermissiondraftcreate.go | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/internal/api/client/admin/domainpermissiondraftcreate.go b/internal/api/client/admin/domainpermissiondraftcreate.go index d20842ebf..ec94f947b 100644 --- a/internal/api/client/admin/domainpermissiondraftcreate.go +++ b/internal/api/client/admin/domainpermissiondraftcreate.go @@ -26,7 +26,6 @@ import ( apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model" apiutil "github.com/superseriousbusiness/gotosocial/internal/api/util" "github.com/superseriousbusiness/gotosocial/internal/gtserror" - "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/oauth" ) @@ -136,24 +135,8 @@ func (m *Module) DomainPermissionDraftsPOSTHandler(c *gin.Context) { return } - var ( - permType gtsmodel.DomainPermissionType - errText string - ) - - switch pt := form.PermissionType; pt { - case "block": - permType = gtsmodel.DomainPermissionBlock - case "allow": - permType = gtsmodel.DomainPermissionAllow - case "": - errText = "permission_type not set, must be one of block or allow" - default: - errText = fmt.Sprintf("permission_type %s not recognized, must be one of block or allow", pt) - } - - if errText != "" { - errWithCode := gtserror.NewErrorBadRequest(errors.New(errText), errText) + permType, errWithCode := parseDomainPermissionType(form.PermissionType) + if errWithCode != nil { apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1) return } |