diff options
author | oliverpool <git@olivier.pfad.fr> | 2024-03-21 14:01:02 +0100 |
---|---|---|
committer | oliverpool <git@olivier.pfad.fr> | 2024-03-27 15:38:39 +0100 |
commit | 97f0ad49ff6245c026265d50da788b8437c7b52f (patch) | |
tree | c6ae4df4bab814803eefa99e66d1e8beb3a9f98b /routers | |
parent | [REFACTOR] webhook telegram endpoint (diff) | |
download | forgejo-97f0ad49ff6245c026265d50da788b8437c7b52f.tar.xz forgejo-97f0ad49ff6245c026265d50da788b8437c7b52f.zip |
[REFACTOR] webhook msteams 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 dc82475aae..ead24614f1 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 { } } -// MSTeamsHooksNewPost response for creating MSTeams webhook -func MSTeamsHooksNewPost(ctx *context.Context) { - createWebhook(ctx, mSTeamsHookParams(ctx)) -} - -// MSTeamsHooksEditPost response for editing MSTeams webhook -func MSTeamsHooksEditPost(ctx *context.Context) { - editWebhook(ctx, mSTeamsHookParams(ctx)) -} - -func mSTeamsHookParams(ctx *context.Context) webhookParams { - form := web.GetForm(ctx).(*forms.NewMSTeamsHookForm) - - return webhookParams{ - Type: webhook_module.MSTEAMS, - URL: form.PayloadURL, - ContentType: webhook.ContentTypeJSON, - WebhookForm: form.WebhookForm, - } -} - // FeishuHooksNewPost response for creating Feishu webhook func FeishuHooksNewPost(ctx *context.Context) { createWebhook(ctx, feishuHookParams(ctx)) diff --git a/routers/web/web.go b/routers/web/web.go index 7e41d7ed49..6d2e380e06 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("/msteams/new", web.Bind(forms.NewMSTeamsHookForm{}), repo_setting.MSTeamsHooksNewPost) m.Post("/feishu/new", web.Bind(forms.NewFeishuHookForm{}), repo_setting.FeishuHooksNewPost) m.Post("/wechatwork/new", web.Bind(forms.NewWechatWorkHookForm{}), repo_setting.WechatworkHooksNewPost) m.Post("/packagist/new", web.Bind(forms.NewPackagistHookForm{}), repo_setting.PackagistHooksNewPost) @@ -412,7 +411,6 @@ func registerRoutes(m *web.Route) { addWebhookEditRoutes := func() { m.Post("/gogs/{id}", web.Bind(forms.NewGogshookForm{}), repo_setting.GogsHooksEditPost) - m.Post("/msteams/{id}", web.Bind(forms.NewMSTeamsHookForm{}), repo_setting.MSTeamsHooksEditPost) m.Post("/feishu/{id}", web.Bind(forms.NewFeishuHookForm{}), repo_setting.FeishuHooksEditPost) m.Post("/wechatwork/{id}", web.Bind(forms.NewWechatWorkHookForm{}), repo_setting.WechatworkHooksEditPost) m.Post("/packagist/{id}", web.Bind(forms.NewPackagistHookForm{}), repo_setting.PackagistHooksEditPost) |