summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authoroliverpool <git@olivier.pfad.fr>2024-03-21 13:54:27 +0100
committeroliverpool <git@olivier.pfad.fr>2024-03-27 15:38:39 +0100
commitc3f8e6ed604e3b1a88b8d8d03440e2f5b7d96288 (patch)
tree2ca4b5bce4fdf7d88dfa053279feb96333839123 /routers
parent[REFACTOR] webhook slack endpoints (diff)
downloadforgejo-c3f8e6ed604e3b1a88b8d8d03440e2f5b7d96288.tar.xz
forgejo-c3f8e6ed604e3b1a88b8d8d03440e2f5b7d96288.zip
[REFACTOR] webhook discord endpoint
Diffstat (limited to 'routers')
-rw-r--r--routers/web/repo/setting/webhook.go25
-rw-r--r--routers/web/web.go2
2 files changed, 0 insertions, 27 deletions
diff --git a/routers/web/repo/setting/webhook.go b/routers/web/repo/setting/webhook.go
index ca686cac63..50ff6698f2 100644
--- a/routers/web/repo/setting/webhook.go
+++ b/routers/web/repo/setting/webhook.go
@@ -388,31 +388,6 @@ func gogsHookParams(ctx *context.Context) webhookParams {
}
}
-// DiscordHooksNewPost response for creating Discord webhook
-func DiscordHooksNewPost(ctx *context.Context) {
- createWebhook(ctx, discordHookParams(ctx))
-}
-
-// DiscordHooksEditPost response for editing Discord webhook
-func DiscordHooksEditPost(ctx *context.Context) {
- editWebhook(ctx, discordHookParams(ctx))
-}
-
-func discordHookParams(ctx *context.Context) webhookParams {
- form := web.GetForm(ctx).(*forms.NewDiscordHookForm)
-
- return webhookParams{
- Type: webhook_module.DISCORD,
- URL: form.PayloadURL,
- ContentType: webhook.ContentTypeJSON,
- WebhookForm: form.WebhookForm,
- Meta: &webhook_service.DiscordMeta{
- Username: form.Username,
- IconURL: form.IconURL,
- },
- }
-}
-
// DingtalkHooksNewPost response for creating Dingtalk webhook
func DingtalkHooksNewPost(ctx *context.Context) {
createWebhook(ctx, dingtalkHookParams(ctx))
diff --git a/routers/web/web.go b/routers/web/web.go
index 92f2680657..9d4e07df24 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("/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)
m.Post("/msteams/new", web.Bind(forms.NewMSTeamsHookForm{}), repo_setting.MSTeamsHooksNewPost)
@@ -415,7 +414,6 @@ func registerRoutes(m *web.Route) {
addWebhookEditRoutes := func() {
m.Post("/gogs/{id}", web.Bind(forms.NewGogshookForm{}), repo_setting.GogsHooksEditPost)
- 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)
m.Post("/msteams/{id}", web.Bind(forms.NewMSTeamsHookForm{}), repo_setting.MSTeamsHooksEditPost)