aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/repo/editor.go
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2021-12-15 14:59:57 +0800
committerGitHub <noreply@github.com>2021-12-15 14:59:57 +0800
commit4da1d9781025aa4a85899b1ddeb25aabbaa82703 (patch)
tree9714f71f2fb042e44d418fbcfc56cd8440a1bbb1 /routers/web/repo/editor.go
parent9d943bf374e56e4d403303a6a2caafc1c79cdb6f (diff)
downloadgitea-4da1d9781025aa4a85899b1ddeb25aabbaa82703.tar.gz
gitea-4da1d9781025aa4a85899b1ddeb25aabbaa82703.zip
Refactor HTTP request context (#17979)
Diffstat (limited to 'routers/web/repo/editor.go')
-rw-r--r--routers/web/repo/editor.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/routers/web/repo/editor.go b/routers/web/repo/editor.go
index 97f097783a..ef2166d85c 100644
--- a/routers/web/repo/editor.go
+++ b/routers/web/repo/editor.go
@@ -307,7 +307,7 @@ func editFilePost(ctx *context.Context, form forms.EditRepoFileForm, isNewFile b
if len(errPushRej.Message) == 0 {
ctx.RenderWithErr(ctx.Tr("repo.editor.push_rejected_no_message"), tplEditFile, &form)
} else {
- flashError, err := ctx.HTMLString(string(tplAlertDetails), map[string]interface{}{
+ flashError, err := ctx.RenderToString(tplAlertDetails, map[string]interface{}{
"Message": ctx.Tr("repo.editor.push_rejected"),
"Summary": ctx.Tr("repo.editor.push_rejected_summary"),
"Details": utils.SanitizeFlashErrorString(errPushRej.Message),
@@ -319,7 +319,7 @@ func editFilePost(ctx *context.Context, form forms.EditRepoFileForm, isNewFile b
ctx.RenderWithErr(flashError, tplEditFile, &form)
}
} else {
- flashError, err := ctx.HTMLString(string(tplAlertDetails), map[string]interface{}{
+ flashError, err := ctx.RenderToString(tplAlertDetails, map[string]interface{}{
"Message": ctx.Tr("repo.editor.fail_to_update_file", form.TreePath),
"Summary": ctx.Tr("repo.editor.fail_to_update_file_summary"),
"Details": utils.SanitizeFlashErrorString(err.Error()),
@@ -376,7 +376,7 @@ func DiffPreviewPost(ctx *context.Context) {
}
if diff.NumFiles == 0 {
- ctx.PlainText(200, []byte(ctx.Tr("repo.editor.no_changes_to_show")))
+ ctx.PlainText(http.StatusOK, ctx.Tr("repo.editor.no_changes_to_show"))
return
}
ctx.Data["File"] = diff.Files[0]
@@ -501,7 +501,7 @@ func DeleteFilePost(ctx *context.Context) {
if len(errPushRej.Message) == 0 {
ctx.RenderWithErr(ctx.Tr("repo.editor.push_rejected_no_message"), tplDeleteFile, &form)
} else {
- flashError, err := ctx.HTMLString(string(tplAlertDetails), map[string]interface{}{
+ flashError, err := ctx.RenderToString(tplAlertDetails, map[string]interface{}{
"Message": ctx.Tr("repo.editor.push_rejected"),
"Summary": ctx.Tr("repo.editor.push_rejected_summary"),
"Details": utils.SanitizeFlashErrorString(errPushRej.Message),
@@ -704,7 +704,7 @@ func UploadFilePost(ctx *context.Context) {
if len(errPushRej.Message) == 0 {
ctx.RenderWithErr(ctx.Tr("repo.editor.push_rejected_no_message"), tplUploadFile, &form)
} else {
- flashError, err := ctx.HTMLString(string(tplAlertDetails), map[string]interface{}{
+ flashError, err := ctx.RenderToString(tplAlertDetails, map[string]interface{}{
"Message": ctx.Tr("repo.editor.push_rejected"),
"Summary": ctx.Tr("repo.editor.push_rejected_summary"),
"Details": utils.SanitizeFlashErrorString(errPushRej.Message),