[REFACTOR] webhook dingtalk endpoint
This commit is contained in:
parent
c3f8e6ed60
commit
9dff719523
4 changed files with 15 additions and 36 deletions
|
@ -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))
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue