mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-23 18:54:39 +02:00
Merge branch 'main' of https://github.com/go-gitea/gitea into pr/ChristopherHX/33964-1
This commit is contained in:
commit
3e3be37337
362 files changed
+6589
-3099
No files matched your search
@@ -14,9 +14,11 @@ import (
|
||||
|
||||
// AuthenticationForm form for authentication
|
||||
type AuthenticationForm struct {
|
||||
ID int64
|
||||
Type int `binding:"Range(2,7)"`
|
||||
Name string `binding:"Required;MaxSize(30)"`
|
||||
ID int64
|
||||
Type int `binding:"Range(2,7)"`
|
||||
Name string `binding:"Required;MaxSize(30)"`
|
||||
TwoFactorPolicy string
|
||||
|
||||
Host string
|
||||
Port int
|
||||
BindDN string
|
||||
@@ -74,7 +76,6 @@ type AuthenticationForm struct {
|
||||
Oauth2RestrictedGroup string
|
||||
Oauth2GroupTeamMap string `binding:"ValidGroupTeamMap"`
|
||||
Oauth2GroupTeamMapRemoval bool
|
||||
SkipLocalTwoFA bool
|
||||
SSPIAutoCreateUsers bool
|
||||
SSPIAutoActivateUsers bool
|
||||
SSPIStripDomainNames bool
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
|
||||
issues_model "code.gitea.io/gitea/models/issues"
|
||||
project_model "code.gitea.io/gitea/models/project"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/modules/web/middleware"
|
||||
"code.gitea.io/gitea/services/context"
|
||||
@@ -474,22 +473,6 @@ func (i *IssueLockForm) Validate(req *http.Request, errs binding.Errors) binding
|
||||
return middleware.Validate(errs, ctx.Data, i, ctx.Locale)
|
||||
}
|
||||
|
||||
// HasValidReason checks to make sure that the reason submitted in
|
||||
// the form matches any of the values in the config
|
||||
func (i IssueLockForm) HasValidReason() bool {
|
||||
if strings.TrimSpace(i.Reason) == "" {
|
||||
return true
|
||||
}
|
||||
|
||||
for _, v := range setting.Repository.Issue.LockReasons {
|
||||
if v == i.Reason {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// CreateProjectForm form for creating a project
|
||||
type CreateProjectForm struct {
|
||||
Title string `binding:"Required;MaxSize(100)"`
|
||||
|
||||
@@ -6,8 +6,6 @@ package forms
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@@ -39,26 +37,3 @@ func TestSubmitReviewForm_IsEmpty(t *testing.T) {
|
||||
assert.Equal(t, v.expected, v.form.HasEmptyContent())
|
||||
}
|
||||
}
|
||||
|
||||
func TestIssueLock_HasValidReason(t *testing.T) {
|
||||
// Init settings
|
||||
_ = setting.Repository
|
||||
|
||||
cases := []struct {
|
||||
form IssueLockForm
|
||||
expected bool
|
||||
}{
|
||||
{IssueLockForm{""}, true}, // an empty reason is accepted
|
||||
{IssueLockForm{"Off-topic"}, true},
|
||||
{IssueLockForm{"Too heated"}, true},
|
||||
{IssueLockForm{"Spam"}, true},
|
||||
{IssueLockForm{"Resolved"}, true},
|
||||
|
||||
{IssueLockForm{"ZZZZ"}, false},
|
||||
{IssueLockForm{"I want to lock this issue"}, false},
|
||||
}
|
||||
|
||||
for _, v := range cases {
|
||||
assert.Equal(t, v.expected, v.form.HasValidReason())
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user