Skip to content

Commit a3b1053

Browse files
aungerdaviian
authored andcommitted
Fix webhook type conflation. (#4285) (#4289)
- Fix typo that caused Gogs hooks to be created as Gitea hooks. - Fix typo that caused Gogs hooks to be duplicated upon edit (though this bug was masked by the previous one). Signed-off-by: Russell Aunger <[email protected]>
1 parent caee487 commit a3b1053

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

routers/repo/webhook.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ func GogsHooksNewPost(ctx *context.Context, form auth.NewGogshookForm) {
205205
Secret: form.Secret,
206206
HookEvent: ParseHookEvent(form.WebhookForm),
207207
IsActive: form.Active,
208-
HookTaskType: models.GITEA,
208+
HookTaskType: models.GOGS,
209209
OrgID: orCtx.OrgID,
210210
}
211211
if err := w.UpdateEvent(); err != nil {

routers/routes/routes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ func RegisterRoutes(m *macaron.Macaron) {
446446
m.Get("/:id", repo.WebHooksEdit)
447447
m.Post("/:id/test", repo.TestWebhook)
448448
m.Post("/gitea/:id", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksEditPost)
449-
m.Post("/gogs/:id", bindIgnErr(auth.NewGogshookForm{}), repo.GogsHooksNewPost)
449+
m.Post("/gogs/:id", bindIgnErr(auth.NewGogshookForm{}), repo.GogsHooksEditPost)
450450
m.Post("/slack/:id", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksEditPost)
451451
m.Post("/discord/:id", bindIgnErr(auth.NewDiscordHookForm{}), repo.DiscordHooksEditPost)
452452
m.Post("/dingtalk/:id", bindIgnErr(auth.NewDingtalkHookForm{}), repo.DingtalkHooksEditPost)

0 commit comments

Comments
 (0)