mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
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
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
// .___
|
||||
// | | ______ ________ __ ____
|
||||
// | |/ ___// ___/ | \_/ __ \
|
||||
|
@@ -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)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user