|
|
|
@ -13,10 +13,10 @@ import ( |
|
|
|
|
"code.gitea.io/gitea/models" |
|
|
|
|
"code.gitea.io/gitea/modules/context" |
|
|
|
|
"code.gitea.io/gitea/modules/log" |
|
|
|
|
"code.gitea.io/gitea/modules/middlewares" |
|
|
|
|
"code.gitea.io/gitea/modules/setting" |
|
|
|
|
"code.gitea.io/gitea/modules/structs" |
|
|
|
|
"code.gitea.io/gitea/modules/util" |
|
|
|
|
"code.gitea.io/gitea/modules/web/middleware" |
|
|
|
|
"code.gitea.io/gitea/routers/utils" |
|
|
|
|
|
|
|
|
|
"gitea.com/go-chi/binding" |
|
|
|
@ -56,7 +56,7 @@ type CreateRepoForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *CreateRepoForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// MigrateRepoForm form for migrating repository
|
|
|
|
@ -87,7 +87,7 @@ type MigrateRepoForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *MigrateRepoForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// ParseRemoteAddr checks if given remote address is valid,
|
|
|
|
@ -172,7 +172,7 @@ type RepoSettingForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *RepoSettingForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// __________ .__
|
|
|
|
@ -209,7 +209,7 @@ type ProtectBranchForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *ProtectBranchForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// __ __ ___. .__ .__ __
|
|
|
|
@ -271,7 +271,7 @@ type NewWebhookForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *NewWebhookForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// NewGogshookForm form for creating gogs hook
|
|
|
|
@ -285,7 +285,7 @@ type NewGogshookForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *NewGogshookForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// NewSlackHookForm form for creating slack hook
|
|
|
|
@ -301,7 +301,7 @@ type NewSlackHookForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *NewSlackHookForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// HasInvalidChannel validates the channel name is in the right format
|
|
|
|
@ -320,7 +320,7 @@ type NewDiscordHookForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *NewDiscordHookForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// NewDingtalkHookForm form for creating dingtalk hook
|
|
|
|
@ -332,7 +332,7 @@ type NewDingtalkHookForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *NewDingtalkHookForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// NewTelegramHookForm form for creating telegram hook
|
|
|
|
@ -345,7 +345,7 @@ type NewTelegramHookForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *NewTelegramHookForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// NewMatrixHookForm form for creating Matrix hook
|
|
|
|
@ -360,7 +360,7 @@ type NewMatrixHookForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *NewMatrixHookForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// NewMSTeamsHookForm form for creating MS Teams hook
|
|
|
|
@ -372,7 +372,7 @@ type NewMSTeamsHookForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *NewMSTeamsHookForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// NewFeishuHookForm form for creating feishu hook
|
|
|
|
@ -384,7 +384,7 @@ type NewFeishuHookForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *NewFeishuHookForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// .___
|
|
|
|
@ -410,7 +410,7 @@ type CreateIssueForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *CreateIssueForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// CreateCommentForm form for creating comment
|
|
|
|
@ -423,7 +423,7 @@ type CreateCommentForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *CreateCommentForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// ReactionForm form for adding and removing reaction
|
|
|
|
@ -434,7 +434,7 @@ type ReactionForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *ReactionForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// IssueLockForm form for locking an issue
|
|
|
|
@ -445,7 +445,7 @@ type IssueLockForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (i *IssueLockForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, i, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, i, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// HasValidReason checks to make sure that the reason submitted in
|
|
|
|
@ -510,7 +510,7 @@ type CreateMilestoneForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *CreateMilestoneForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// .____ ___. .__
|
|
|
|
@ -531,7 +531,7 @@ type CreateLabelForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *CreateLabelForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// InitializeLabelsForm form for initializing labels
|
|
|
|
@ -542,7 +542,7 @@ type InitializeLabelsForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *InitializeLabelsForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// __________ .__ .__ __________ __
|
|
|
|
@ -566,7 +566,7 @@ type MergePullRequestForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *MergePullRequestForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// CodeCommentForm form for adding code comments for PRs
|
|
|
|
@ -584,7 +584,7 @@ type CodeCommentForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *CodeCommentForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// SubmitReviewForm for submitting a finished code review
|
|
|
|
@ -597,7 +597,7 @@ type SubmitReviewForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *SubmitReviewForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// ReviewType will return the corresponding reviewtype for type
|
|
|
|
@ -643,7 +643,7 @@ type NewReleaseForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *NewReleaseForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// EditReleaseForm form for changing release
|
|
|
|
@ -658,7 +658,7 @@ type EditReleaseForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *EditReleaseForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// __ __.__ __ .__
|
|
|
|
@ -679,7 +679,7 @@ type NewWikiForm struct { |
|
|
|
|
// FIXME: use code generation to generate this method.
|
|
|
|
|
func (f *NewWikiForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// ___________ .___.__ __
|
|
|
|
@ -704,7 +704,7 @@ type EditRepoFileForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *EditRepoFileForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// EditPreviewDiffForm form for changing preview diff
|
|
|
|
@ -715,7 +715,7 @@ type EditPreviewDiffForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *EditPreviewDiffForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// ____ ___ .__ .___
|
|
|
|
@ -740,7 +740,7 @@ type UploadRepoFileForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *UploadRepoFileForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// RemoveUploadFileForm form for removing uploaded file
|
|
|
|
@ -751,7 +751,7 @@ type RemoveUploadFileForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *RemoveUploadFileForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// ________ .__ __
|
|
|
|
@ -774,7 +774,7 @@ type DeleteRepoFileForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *DeleteRepoFileForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// ___________.__ ___________ __
|
|
|
|
@ -793,7 +793,7 @@ type AddTimeManuallyForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *AddTimeManuallyForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// SaveTopicForm form for save topics for repository
|
|
|
|
@ -809,5 +809,5 @@ type DeadlineForm struct { |
|
|
|
|
// Validate validates the fields
|
|
|
|
|
func (f *DeadlineForm) Validate(req *http.Request, errs binding.Errors) binding.Errors { |
|
|
|
|
ctx := context.GetContext(req) |
|
|
|
|
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale) |
|
|
|
|
} |
|
|
|
|