mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 05:18:25 +00:00 
			
		
		
		
	Bug fix for edit-hook API endpoint
This commit is contained in:
		
				
					committed by
					
						
						Kim "BKC" Carlbäcker
					
				
			
			
				
	
			
			
			
						parent
						
							bab737bf02
						
					
				
				
					commit
					7b5b5178e1
				
			@@ -102,7 +102,8 @@ func CreateHook(ctx *context.APIContext, form api.CreateHookOption) {
 | 
				
			|||||||
// EditHook modify a hook of a repository
 | 
					// EditHook modify a hook of a repository
 | 
				
			||||||
// see https://github.com/gogits/go-gogs-client/wiki/Repositories#edit-a-hook
 | 
					// see https://github.com/gogits/go-gogs-client/wiki/Repositories#edit-a-hook
 | 
				
			||||||
func EditHook(ctx *context.APIContext, form api.EditHookOption) {
 | 
					func EditHook(ctx *context.APIContext, form api.EditHookOption) {
 | 
				
			||||||
	w, err := models.GetWebhookByRepoID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id"))
 | 
						hookID := ctx.ParamsInt64(":id")
 | 
				
			||||||
 | 
						w, err := models.GetWebhookByRepoID(ctx.Repo.Repository.ID, hookID)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		if models.IsErrWebhookNotExist(err) {
 | 
							if models.IsErrWebhookNotExist(err) {
 | 
				
			||||||
			ctx.Status(404)
 | 
								ctx.Status(404)
 | 
				
			||||||
@@ -165,7 +166,12 @@ func EditHook(ctx *context.APIContext, form api.EditHookOption) {
 | 
				
			|||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ctx.JSON(200, convert.ToHook(ctx.Repo.RepoLink, w))
 | 
						updated, err := models.GetWebhookByRepoID(ctx.Repo.Repository.ID, hookID)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							ctx.Error(500, "GetWebhookByRepoID", err)
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						ctx.JSON(200, convert.ToHook(ctx.Repo.RepoLink, updated))
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// DeleteHook delete a hook of a repository
 | 
					// DeleteHook delete a hook of a repository
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user