summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authoroliverpool <git@olivier.pfad.fr>2024-03-21 13:51:35 +0100
committeroliverpool <git@olivier.pfad.fr>2024-03-27 15:38:38 +0100
commit6f00821f3d3aa1eee39af93071d44433c6ff1d66 (patch)
treee975ccda539d6976aac2673233a6971033dd4cdf /routers
parent[REFACTOR] webhook forgejo/gitea endpoints (diff)
downloadforgejo-6f00821f3d3aa1eee39af93071d44433c6ff1d66.tar.xz
forgejo-6f00821f3d3aa1eee39af93071d44433c6ff1d66.zip
[REFACTOR] webhook slack endpoints
Diffstat (limited to 'routers')
-rw-r--r--routers/web/repo/setting/webhook.go27
-rw-r--r--routers/web/web.go2
2 files changed, 0 insertions, 29 deletions
diff --git a/routers/web/repo/setting/webhook.go b/routers/web/repo/setting/webhook.go
index 8900942190..ca686cac63 100644
--- a/routers/web/repo/setting/webhook.go
+++ b/routers/web/repo/setting/webhook.go
@@ -481,33 +481,6 @@ func mSTeamsHookParams(ctx *context.Context) webhookParams {
}
}
-// SlackHooksNewPost response for creating Slack webhook
-func SlackHooksNewPost(ctx *context.Context) {
- createWebhook(ctx, slackHookParams(ctx))
-}
-
-// SlackHooksEditPost response for editing Slack webhook
-func SlackHooksEditPost(ctx *context.Context) {
- editWebhook(ctx, slackHookParams(ctx))
-}
-
-func slackHookParams(ctx *context.Context) webhookParams {
- form := web.GetForm(ctx).(*forms.NewSlackHookForm)
-
- return webhookParams{
- Type: webhook_module.SLACK,
- URL: form.PayloadURL,
- ContentType: webhook.ContentTypeJSON,
- WebhookForm: form.WebhookForm,
- Meta: &webhook_service.SlackMeta{
- Channel: strings.TrimSpace(form.Channel),
- Username: form.Username,
- IconURL: form.IconURL,
- Color: form.Color,
- },
- }
-}
-
// 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 06ef485422..92f2680657 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("/slack/new", web.Bind(forms.NewSlackHookForm{}), repo_setting.SlackHooksNewPost)
m.Post("/discord/new", web.Bind(forms.NewDiscordHookForm{}), repo_setting.DiscordHooksNewPost)
m.Post("/dingtalk/new", web.Bind(forms.NewDingtalkHookForm{}), repo_setting.DingtalkHooksNewPost)
m.Post("/telegram/new", web.Bind(forms.NewTelegramHookForm{}), repo_setting.TelegramHooksNewPost)
@@ -416,7 +415,6 @@ func registerRoutes(m *web.Route) {
addWebhookEditRoutes := func() {
m.Post("/gogs/{id}", web.Bind(forms.NewGogshookForm{}), repo_setting.GogsHooksEditPost)
- m.Post("/slack/{id}", web.Bind(forms.NewSlackHookForm{}), repo_setting.SlackHooksEditPost)
m.Post("/discord/{id}", web.Bind(forms.NewDiscordHookForm{}), repo_setting.DiscordHooksEditPost)
m.Post("/dingtalk/{id}", web.Bind(forms.NewDingtalkHookForm{}), repo_setting.DingtalkHooksEditPost)
m.Post("/telegram/{id}", web.Bind(forms.NewTelegramHookForm{}), repo_setting.TelegramHooksEditPost)