diff options
author | oliverpool <git@olivier.pfad.fr> | 2024-03-21 13:57:14 +0100 |
---|---|---|
committer | oliverpool <git@olivier.pfad.fr> | 2024-03-27 15:38:39 +0100 |
commit | 9dff719523d0db7599262760a099a69194e187a4 (patch) | |
tree | 61f22ca0f3ef3abdefd93617c758afb0ce5a480c /routers | |
parent | [REFACTOR] webhook discord endpoint (diff) | |
download | forgejo-9dff719523d0db7599262760a099a69194e187a4.tar.xz forgejo-9dff719523d0db7599262760a099a69194e187a4.zip |
[REFACTOR] webhook dingtalk endpoint
Diffstat (limited to 'routers')
-rw-r--r-- | routers/web/repo/setting/webhook.go | 21 | ||||
-rw-r--r-- | routers/web/web.go | 2 |
2 files changed, 0 insertions, 23 deletions
diff --git a/routers/web/repo/setting/webhook.go b/routers/web/repo/setting/webhook.go index 50ff6698f2..29b28cfd30 100644 --- a/routers/web/repo/setting/webhook.go +++ b/routers/web/repo/setting/webhook.go @@ -388,27 +388,6 @@ func gogsHookParams(ctx *context.Context) webhookParams { } } -// DingtalkHooksNewPost response for creating Dingtalk webhook -func DingtalkHooksNewPost(ctx *context.Context) { - createWebhook(ctx, dingtalkHookParams(ctx)) -} - -// DingtalkHooksEditPost response for editing Dingtalk webhook -func DingtalkHooksEditPost(ctx *context.Context) { - editWebhook(ctx, dingtalkHookParams(ctx)) -} - -func dingtalkHookParams(ctx *context.Context) webhookParams { - form := web.GetForm(ctx).(*forms.NewDingtalkHookForm) - - return webhookParams{ - Type: webhook_module.DINGTALK, - URL: form.PayloadURL, - ContentType: webhook.ContentTypeJSON, - WebhookForm: form.WebhookForm, - } -} - // TelegramHooksNewPost response for creating Telegram webhook func TelegramHooksNewPost(ctx *context.Context) { createWebhook(ctx, telegramHookParams(ctx)) diff --git a/routers/web/web.go b/routers/web/web.go index 9d4e07df24..116ffccad5 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -403,7 +403,6 @@ func registerRoutes(m *web.Route) { addWebhookAddRoutes := func() { m.Get("/{type}/new", repo_setting.WebhooksNew) m.Post("/gogs/new", web.Bind(forms.NewGogshookForm{}), repo_setting.GogsHooksNewPost) - m.Post("/dingtalk/new", web.Bind(forms.NewDingtalkHookForm{}), repo_setting.DingtalkHooksNewPost) m.Post("/telegram/new", web.Bind(forms.NewTelegramHookForm{}), repo_setting.TelegramHooksNewPost) m.Post("/msteams/new", web.Bind(forms.NewMSTeamsHookForm{}), repo_setting.MSTeamsHooksNewPost) m.Post("/feishu/new", web.Bind(forms.NewFeishuHookForm{}), repo_setting.FeishuHooksNewPost) @@ -414,7 +413,6 @@ func registerRoutes(m *web.Route) { addWebhookEditRoutes := func() { m.Post("/gogs/{id}", web.Bind(forms.NewGogshookForm{}), repo_setting.GogsHooksEditPost) - m.Post("/dingtalk/{id}", web.Bind(forms.NewDingtalkHookForm{}), repo_setting.DingtalkHooksEditPost) m.Post("/telegram/{id}", web.Bind(forms.NewTelegramHookForm{}), repo_setting.TelegramHooksEditPost) m.Post("/msteams/{id}", web.Bind(forms.NewMSTeamsHookForm{}), repo_setting.MSTeamsHooksEditPost) m.Post("/feishu/{id}", web.Bind(forms.NewFeishuHookForm{}), repo_setting.FeishuHooksEditPost) |