mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-14 05:52:43 +00:00
Slack webhook channel name cannot be empty or just contain an hashtag (#4786)
This commit is contained in:
parent
6e03390aa8
commit
be48397945
6 changed files with 69 additions and 5 deletions
|
@ -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"`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue