From 9da4910a6594cfd1a8fc5c47abf85f3d7b4c2fc6 Mon Sep 17 00:00:00 2001 From: Gary Kim Date: Sun, 25 Aug 2019 20:15:22 +0800 Subject: [PATCH 1/2] Fix adding default Telegram webhook Fixes #7932 Signed-off-by: Gary Kim --- routers/routes/routes.go | 2 ++ templates/admin/hook_new.tmpl | 3 +++ 2 files changed, 5 insertions(+) diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 5774c65eca03b..cebe281874963 100644 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -445,6 +445,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Post("/slack/new", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksNewPost) m.Post("/discord/new", bindIgnErr(auth.NewDiscordHookForm{}), repo.DiscordHooksNewPost) m.Post("/dingtalk/new", bindIgnErr(auth.NewDingtalkHookForm{}), repo.DingtalkHooksNewPost) + m.Post("/telegram/new", bindIgnErr(auth.NewTelegramHookForm{}),repo.TelegramHooksNewPost) m.Post("/msteams/new", bindIgnErr(auth.NewMSTeamsHookForm{}), repo.MSTeamsHooksNewPost) m.Get("/:id", repo.WebHooksEdit) m.Post("/gitea/:id", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksEditPost) @@ -452,6 +453,7 @@ func RegisterRoutes(m *macaron.Macaron) { 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) + m.Post("/telegram/:id", bindIgnErr(auth.NewTelegramHookForm{}), repo.TelegramHooksEditPost) m.Post("/msteams/:id", bindIgnErr(auth.NewMSTeamsHookForm{}), repo.MSTeamsHooksNewPost) }) diff --git a/templates/admin/hook_new.tmpl b/templates/admin/hook_new.tmpl index 457c9cde45397..c047efe9a26e8 100644 --- a/templates/admin/hook_new.tmpl +++ b/templates/admin/hook_new.tmpl @@ -20,6 +20,8 @@ {{else if eq .HookType "dingtalk"}} + {{else if eq .HookType "telegram"}} + {{else if eq .HookType "msteams"}} {{end}} @@ -31,6 +33,7 @@ {{template "repo/settings/webhook/slack" .}} {{template "repo/settings/webhook/discord" .}} {{template "repo/settings/webhook/dingtalk" .}} + {{template "repo/settings/webhook/telegram" .}} {{template "repo/settings/webhook/msteams" .}} From 1c89191169d122688ad16bba281d8c4a1ea504ef Mon Sep 17 00:00:00 2001 From: Gary Kim Date: Tue, 27 Aug 2019 06:19:47 +0800 Subject: [PATCH 2/2] Run goimports Signed-off-by: Gary Kim --- routers/routes/routes.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 0d0863b30d7b9..2afd0dcce9fb7 100644 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -446,7 +446,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Post("/slack/new", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksNewPost) m.Post("/discord/new", bindIgnErr(auth.NewDiscordHookForm{}), repo.DiscordHooksNewPost) m.Post("/dingtalk/new", bindIgnErr(auth.NewDingtalkHookForm{}), repo.DingtalkHooksNewPost) - m.Post("/telegram/new", bindIgnErr(auth.NewTelegramHookForm{}),repo.TelegramHooksNewPost) + m.Post("/telegram/new", bindIgnErr(auth.NewTelegramHookForm{}), repo.TelegramHooksNewPost) m.Post("/msteams/new", bindIgnErr(auth.NewMSTeamsHookForm{}), repo.MSTeamsHooksNewPost) m.Get("/:id", repo.WebHooksEdit) m.Post("/gitea/:id", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksEditPost)