From 10b54df2b2efa539fbaa0bf624e81cb5da99f97a Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Tue, 21 Nov 2017 12:26:43 +0800 Subject: Add dingtalk webhook (#2777) * add dingtalk webhook type * add vendor * some fixes * fix name check * fix name check & improvment --- modules/auth/repo_form.go | 11 +++++++++++ modules/setting/setting.go | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go index 6fe826f574..bb917a9114 100644 --- a/modules/auth/repo_form.go +++ b/modules/auth/repo_form.go @@ -222,6 +222,17 @@ func (f *NewDiscordHookForm) Validate(ctx *macaron.Context, errs binding.Errors) return validate(errs, ctx.Data, f, ctx.Locale) } +// NewDingtalkHookForm form for creating dingtalk hook +type NewDingtalkHookForm struct { + PayloadURL string `binding:"Required;ValidUrl"` + WebhookForm +} + +// Validate validates the fields +func (f *NewDingtalkHookForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { + return validate(errs, ctx.Data, f, ctx.Locale) +} + // .___ // | | ______ ________ __ ____ // | |/ ___// ___/ | \_/ __ \ diff --git a/modules/setting/setting.go b/modules/setting/setting.go index d15a76f9bf..d4f92dee39 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -1509,7 +1509,7 @@ func newWebhookService() { Webhook.QueueLength = sec.Key("QUEUE_LENGTH").MustInt(1000) Webhook.DeliverTimeout = sec.Key("DELIVER_TIMEOUT").MustInt(5) Webhook.SkipTLSVerify = sec.Key("SKIP_TLS_VERIFY").MustBool() - Webhook.Types = []string{"gitea", "gogs", "slack", "discord"} + Webhook.Types = []string{"gitea", "gogs", "slack", "discord", "dingtalk"} Webhook.PagingNum = sec.Key("PAGING_NUM").MustInt(10) } -- cgit v1.2.3