summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2017-08-28 13:06:45 +0800
committerGitHub <noreply@github.com>2017-08-28 13:06:45 +0800
commitced50e0ec13085504fa19c82f018a2eecb70ff68 (patch)
tree10dff3ff685a86bad683c731f8329743f217617e /modules
parente41da3845d72e3adc7ae2cd3a02fc1f3943ebee6 (diff)
downloadgitea-ced50e0ec13085504fa19c82f018a2eecb70ff68.tar.gz
gitea-ced50e0ec13085504fa19c82f018a2eecb70ff68.zip
Implementation of discord webhook (#2402)
* implementation of discord webhook * fix webhooks * fix typo and unnecessary color values * fix typo * fix imports and revert changes to webhook_slack.go
Diffstat (limited to 'modules')
-rw-r--r--modules/auth/repo_form.go13
-rw-r--r--modules/setting/setting.go2
2 files changed, 14 insertions, 1 deletions
diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go
index 681a478d3b..70c9c8b4af 100644
--- a/modules/auth/repo_form.go
+++ b/modules/auth/repo_form.go
@@ -183,6 +183,19 @@ func (f *NewSlackHookForm) Validate(ctx *macaron.Context, errs binding.Errors) b
return validate(errs, ctx.Data, f, ctx.Locale)
}
+// NewDiscordHookForm form for creating discord hook
+type NewDiscordHookForm struct {
+ PayloadURL string `binding:"Required;ValidUrl"`
+ Username string
+ IconURL string
+ WebhookForm
+}
+
+// Validate validates the fields
+func (f *NewDiscordHookForm) 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 c25c2e0c65..a5908bacaa 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -1367,7 +1367,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"}
+ Webhook.Types = []string{"gitea", "gogs", "slack", "discord"}
Webhook.PagingNum = sec.Key("PAGING_NUM").MustInt(10)
}