summaryrefslogtreecommitdiff
path: root/internal/api/client/followrequest/followrequest.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2021-10-16 13:27:43 +0200
committerLibravatar GitHub <noreply@github.com>2021-10-16 13:27:43 +0200
commit15621f5324b4613d83efb94711c97eeaa83da2b3 (patch)
treeb86c837dec89f5c74a7127f1bcd8e224bf6dd8a6 /internal/api/client/followrequest/followrequest.go
parentUser password change (#280) (diff)
downloadgotosocial-15621f5324b4613d83efb94711c97eeaa83da2b3.tar.xz
Follow request improvements (#282)
* tiny doc update * add rejectfollowrequest to db * add follow request reject to processor * add reject handler * tidy up follow request api * tidy up federation call * regenerate swagger docs * api endpoint tests * processor test * add reject federatingdb handler * start writing reject tests * test reject follow request * go fmt * increase sleep for slow test setups * more relaxed time.sleep
Diffstat (limited to 'internal/api/client/followrequest/followrequest.go')
-rw-r--r--internal/api/client/followrequest/followrequest.go19
1 files changed, 9 insertions, 10 deletions
diff --git a/internal/api/client/followrequest/followrequest.go b/internal/api/client/followrequest/followrequest.go
index beedeb2d0..4f46e1654 100644
--- a/internal/api/client/followrequest/followrequest.go
+++ b/internal/api/client/followrequest/followrequest.go
@@ -28,21 +28,20 @@ import (
)
const (
- // IDKey is for status UUIDs
+ // IDKey is for account IDs
IDKey = "id"
// BasePath is the base path for serving the follow request API
BasePath = "/api/v1/follow_requests"
// BasePathWithID is just the base path with the ID key in it.
- // Use this anywhere you need to know the ID of the follow request being queried.
+ // Use this anywhere you need to know the ID of the account that owns the follow request being queried.
BasePathWithID = BasePath + "/:" + IDKey
-
- // AcceptPath is used for accepting follow requests
- AcceptPath = BasePathWithID + "/authorize"
- // DenyPath is used for denying follow requests
- DenyPath = BasePathWithID + "/reject"
+ // AuthorizePath is used for authorizing follow requests
+ AuthorizePath = BasePathWithID + "/authorize"
+ // RejectPath is used for rejecting follow requests
+ RejectPath = BasePathWithID + "/reject"
)
-// Module implements the ClientAPIModule interface for every related to interacting with follow requests
+// Module implements the ClientAPIModule interface
type Module struct {
config *config.Config
processor processing.Processor
@@ -59,7 +58,7 @@ func New(config *config.Config, processor processing.Processor) api.ClientModule
// Route attaches all routes from this module to the given router
func (m *Module) Route(r router.Router) error {
r.AttachHandler(http.MethodGet, BasePath, m.FollowRequestGETHandler)
- r.AttachHandler(http.MethodPost, AcceptPath, m.FollowRequestAcceptPOSTHandler)
- r.AttachHandler(http.MethodPost, DenyPath, m.FollowRequestDenyPOSTHandler)
+ r.AttachHandler(http.MethodPost, AuthorizePath, m.FollowRequestAuthorizePOSTHandler)
+ r.AttachHandler(http.MethodPost, RejectPath, m.FollowRequestRejectPOSTHandler)
return nil
}