summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authortechknowlogick <matti@mdranta.net>2019-04-18 22:45:02 -0400
committerGitHub <noreply@github.com>2019-04-18 22:45:02 -0400
commit56da256853001cf3538b8d4ae99798e084935a90 (patch)
treecdbd686d31750aa89365635eb96705c5a9fc1efc /modules
parent6dbd26185203d464c4a4e32e7af04a34f37ae4f2 (diff)
downloadgitea-56da256853001cf3538b8d4ae99798e084935a90.tar.gz
gitea-56da256853001cf3538b8d4ae99798e084935a90.zip
Telegram webhook (#4227)
Diffstat (limited to 'modules')
-rw-r--r--modules/auth/repo_form.go12
-rw-r--r--modules/setting/webhook.go2
2 files changed, 13 insertions, 1 deletions
diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go
index 990a94dd63..d37a5b94d8 100644
--- a/modules/auth/repo_form.go
+++ b/modules/auth/repo_form.go
@@ -263,6 +263,18 @@ func (f *NewDingtalkHookForm) Validate(ctx *macaron.Context, errs binding.Errors
return validate(errs, ctx.Data, f, ctx.Locale)
}
+// NewTelegramHookForm form for creating telegram hook
+type NewTelegramHookForm struct {
+ BotToken string `binding:"Required"`
+ ChatID string `binding:"Required"`
+ WebhookForm
+}
+
+// Validate validates the fields
+func (f *NewTelegramHookForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
+ return validate(errs, ctx.Data, f, ctx.Locale)
+}
+
// .___
// | | ______ ________ __ ____
// | |/ ___// ___/ | \_/ __ \
diff --git a/modules/setting/webhook.go b/modules/setting/webhook.go
index 741963e545..0d91e7d9e7 100644
--- a/modules/setting/webhook.go
+++ b/modules/setting/webhook.go
@@ -25,6 +25,6 @@ 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", "dingtalk"}
+ Webhook.Types = []string{"gitea", "gogs", "slack", "discord", "dingtalk", "telegram"}
Webhook.PagingNum = sec.Key("PAGING_NUM").MustInt(10)
}