mirror of
https://github.com/go-gitea/gitea.git
synced 2026-04-18 07:48:48 +01:00
Deprecate RenderWithErr (#36769)
This commit is contained in:
@@ -98,6 +98,6 @@ func VerifyCaptcha(ctx *Context, tpl templates.TplName, form any) {
|
||||
|
||||
if !valid {
|
||||
ctx.Data["Err_Captcha"] = true
|
||||
ctx.RenderWithErr(ctx.Tr("form.captcha_incorrect"), tpl, form)
|
||||
ctx.RenderWithErrDeprecated(ctx.Tr("form.captcha_incorrect"), tpl, form)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,8 +124,12 @@ func (ctx *Context) RenderToHTML(name templates.TplName, data any) (template.HTM
|
||||
return template.HTML(buf.String()), err
|
||||
}
|
||||
|
||||
// RenderWithErr used for page has form validation but need to prompt error to users.
|
||||
func (ctx *Context) RenderWithErr(msg any, tpl templates.TplName, form any) {
|
||||
// RenderWithErrDeprecated render the page with form validation when it needs to prompt error to users.
|
||||
// Deprecated: use "form-fetch-action" and JSON response instead.
|
||||
// WARNING: in many cases, this function is not able to render the page or recover the form fields correctly.
|
||||
// And it is very difficult to test the page rendered by this function.
|
||||
// DO NOT USE IT ANYMORE.
|
||||
func (ctx *Context) RenderWithErrDeprecated(msg any, tpl templates.TplName, form any) {
|
||||
if form != nil {
|
||||
middleware.AssignForm(form, ctx.Data)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user