mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 02:32:25 -05:00 
			
		
		
		
	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
This commit is contained in:
		
					parent
					
						
							
								107685e22e
							
						
					
				
			
			
				commit
				
					
						15621f5324
					
				
			
		
					 24 changed files with 1256 additions and 69 deletions
				
			
		|  | @ -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 | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue