From 9ae7664df7caa24825cc4cee4e4121e9f1d73e59 Mon Sep 17 00:00:00 2001 From: Russell Aunger Date: Thu, 21 Jun 2018 01:22:03 -0400 Subject: [PATCH] Fix webhook type conflation. (#4285) - 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 --- routers/repo/webhook.go | 2 +- routers/routes/routes.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/routers/repo/webhook.go b/routers/repo/webhook.go index 63450ed88..53c1afe66 100644 --- a/routers/repo/webhook.go +++ b/routers/repo/webhook.go @@ -210,7 +210,7 @@ func GogsHooksNewPost(ctx *context.Context, form auth.NewGogshookForm) { Secret: form.Secret, HookEvent: ParseHookEvent(form.WebhookForm), IsActive: form.Active, - HookTaskType: models.GITEA, + HookTaskType: models.GOGS, OrgID: orCtx.OrgID, } if err := w.UpdateEvent(); err != nil { diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 15b91f159..250b98507 100644 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -486,7 +486,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Get("/:id", repo.WebHooksEdit) m.Post("/:id/test", repo.TestWebhook) m.Post("/gitea/:id", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksEditPost) - m.Post("/gogs/:id", bindIgnErr(auth.NewGogshookForm{}), repo.GogsHooksNewPost) + m.Post("/gogs/:id", bindIgnErr(auth.NewGogshookForm{}), repo.GogsHooksEditPost) m.Post("/slack/:id", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksEditPost) m.Post("/discord/:id", bindIgnErr(auth.NewDiscordHookForm{}), repo.DiscordHooksEditPost) m.Post("/dingtalk/:id", bindIgnErr(auth.NewDingtalkHookForm{}), repo.DingtalkHooksEditPost)