mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Slack webhook channel name cannot be empty or just contain an hashtag (#4786)
This commit is contained in:
committed by
techknowlogick
parent
6e03390aa8
commit
be48397945
@@ -10,6 +10,8 @@ import (
|
||||
"strings"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/routers/utils"
|
||||
|
||||
"github.com/Unknwon/com"
|
||||
"github.com/go-macaron/binding"
|
||||
"gopkg.in/macaron.v1"
|
||||
@@ -225,6 +227,11 @@ func (f *NewSlackHookForm) Validate(ctx *macaron.Context, errs binding.Errors) b
|
||||
return validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// HasInvalidChannel validates the channel name is in the right format
|
||||
func (f NewSlackHookForm) HasInvalidChannel() bool {
|
||||
return !utils.IsValidSlackChannel(f.Channel)
|
||||
}
|
||||
|
||||
// NewDiscordHookForm form for creating discord hook
|
||||
type NewDiscordHookForm struct {
|
||||
PayloadURL string `binding:"Required;ValidUrl"`
|
||||
|
Reference in New Issue
Block a user