forked from forgejo/forgejo
Same perl replacement as https://github.com/go-gitea/gitea/pull/25686 but for 1.20 to ease future backporting.
This commit is contained in:
parent
4e310133f9
commit
24e64fe372
233 changed files with 729 additions and 729 deletions
|
@ -151,7 +151,7 @@ func validateOptions(field *api.IssueFormField, idx int) error {
|
|||
}
|
||||
position := newErrorPosition(idx, field.Type)
|
||||
|
||||
options, ok := field.Attributes["options"].([]interface{})
|
||||
options, ok := field.Attributes["options"].([]any)
|
||||
if !ok || len(options) == 0 {
|
||||
return position.Errorf("'options' is required and should be a array")
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ func validateOptions(field *api.IssueFormField, idx int) error {
|
|||
return position.Errorf("should be a string")
|
||||
}
|
||||
case api.IssueFormFieldTypeCheckboxes:
|
||||
opt, ok := option.(map[string]interface{})
|
||||
opt, ok := option.(map[string]any)
|
||||
if !ok {
|
||||
return position.Errorf("should be a dictionary")
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ func validateOptions(field *api.IssueFormField, idx int) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func validateStringItem(position errorPosition, m map[string]interface{}, required bool, names ...string) error {
|
||||
func validateStringItem(position errorPosition, m map[string]any, required bool, names ...string) error {
|
||||
for _, name := range names {
|
||||
v, ok := m[name]
|
||||
if !ok {
|
||||
|
@ -202,7 +202,7 @@ func validateStringItem(position errorPosition, m map[string]interface{}, requir
|
|||
return nil
|
||||
}
|
||||
|
||||
func validateBoolItem(position errorPosition, m map[string]interface{}, names ...string) error {
|
||||
func validateBoolItem(position errorPosition, m map[string]any, names ...string) error {
|
||||
for _, name := range names {
|
||||
v, ok := m[name]
|
||||
if !ok {
|
||||
|
@ -217,7 +217,7 @@ func validateBoolItem(position errorPosition, m map[string]interface{}, names ..
|
|||
|
||||
type errorPosition string
|
||||
|
||||
func (p errorPosition) Errorf(format string, a ...interface{}) error {
|
||||
func (p errorPosition) Errorf(format string, a ...any) error {
|
||||
return fmt.Errorf(string(p)+": "+format, a...)
|
||||
}
|
||||
|
||||
|
@ -332,7 +332,7 @@ func (f *valuedField) Value() string {
|
|||
}
|
||||
|
||||
func (f *valuedField) Options() []*valuedOption {
|
||||
if options, ok := f.Attributes["options"].([]interface{}); ok {
|
||||
if options, ok := f.Attributes["options"].([]any); ok {
|
||||
ret := make([]*valuedOption, 0, len(options))
|
||||
for i, option := range options {
|
||||
ret = append(ret, &valuedOption{
|
||||
|
@ -348,7 +348,7 @@ func (f *valuedField) Options() []*valuedOption {
|
|||
|
||||
type valuedOption struct {
|
||||
index int
|
||||
data interface{}
|
||||
data any
|
||||
field *valuedField
|
||||
}
|
||||
|
||||
|
@ -359,7 +359,7 @@ func (o *valuedOption) Label() string {
|
|||
return label
|
||||
}
|
||||
case api.IssueFormFieldTypeCheckboxes:
|
||||
if vs, ok := o.data.(map[string]interface{}); ok {
|
||||
if vs, ok := o.data.(map[string]any); ok {
|
||||
if v, ok := vs["label"].(string); ok {
|
||||
return v
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue