File tree 1 file changed +8
-2
lines changed 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,8 @@ func CreateHook(ctx *context.APIContext, form api.CreateHookOption) {
102
102
// EditHook modify a hook of a repository
103
103
// see https://github.com/gogits/go-gogs-client/wiki/Repositories#edit-a-hook
104
104
func EditHook (ctx * context.APIContext , form api.EditHookOption ) {
105
- w , err := models .GetWebhookByRepoID (ctx .Repo .Repository .ID , ctx .ParamsInt64 (":id" ))
105
+ hookID := ctx .ParamsInt64 (":id" )
106
+ w , err := models .GetWebhookByRepoID (ctx .Repo .Repository .ID , hookID )
106
107
if err != nil {
107
108
if models .IsErrWebhookNotExist (err ) {
108
109
ctx .Status (404 )
@@ -165,7 +166,12 @@ func EditHook(ctx *context.APIContext, form api.EditHookOption) {
165
166
return
166
167
}
167
168
168
- ctx .JSON (200 , convert .ToHook (ctx .Repo .RepoLink , w ))
169
+ updated , err := models .GetWebhookByRepoID (ctx .Repo .Repository .ID , hookID )
170
+ if err != nil {
171
+ ctx .Error (500 , "GetWebhookByRepoID" , err )
172
+ return
173
+ }
174
+ ctx .JSON (200 , convert .ToHook (ctx .Repo .RepoLink , updated ))
169
175
}
170
176
171
177
// DeleteHook delete a hook of a repository
You can’t perform that action at this time.
0 commit comments