summaryrefslogtreecommitdiffstats
path: root/routers/web
diff options
context:
space:
mode:
authorbuckybytes <158571971+buckybytes@users.noreply.github.com>2024-03-18 03:23:08 +0100
committerEarl Warren <contact@earl-warren.org>2024-03-26 19:04:25 +0100
commit0d3ddec26c1bf779fca60afdfd23fb1a44ad2e44 (patch)
treef1e9d86676923f742e714131a25137c79745509a /routers/web
parent[skip ci] Updated licenses and gitignores (diff)
downloadforgejo-0d3ddec26c1bf779fca60afdfd23fb1a44ad2e44.tar.xz
forgejo-0d3ddec26c1bf779fca60afdfd23fb1a44ad2e44.zip
Editor error message misleading due to re-used key. (#29859)
The error message: `editor.file_changed_while_editing = The file contents have changed since you started editing. <a target="_blank" rel="noopener noreferrer" href="%s">Click here</a> to see them or <strong>Commit Changes again</strong> to overwrite them.` Is re-used in inappropriate contexts. The link in the key goes to a 404 when the key is used in a situation where the file contents have not changed. Added two new keys to differentiate commit id mismatch and push out of date conditions. (cherry picked from commit 16e360099d0a515d429538ec88cff1f3ede23fb4)
Diffstat (limited to 'routers/web')
-rw-r--r--routers/web/repo/editor.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/routers/web/repo/editor.go b/routers/web/repo/editor.go
index 4f26c0c521..edfae96050 100644
--- a/routers/web/repo/editor.go
+++ b/routers/web/repo/editor.go
@@ -374,9 +374,9 @@ func editFilePost(ctx *context.Context, form forms.EditRepoFileForm, isNewFile b
ctx.Error(http.StatusInternalServerError, err.Error())
}
} else if models.IsErrCommitIDDoesNotMatch(err) {
- ctx.RenderWithErr(ctx.Tr("repo.editor.file_changed_while_editing", ctx.Repo.RepoLink+"/compare/"+util.PathEscapeSegments(form.LastCommit)+"..."+util.PathEscapeSegments(ctx.Repo.CommitID)), tplEditFile, &form)
+ ctx.RenderWithErr(ctx.Tr("repo.editor.commit_id_not_matching", ctx.Repo.RepoLink+"/compare/"+util.PathEscapeSegments(form.LastCommit)+"..."+util.PathEscapeSegments(ctx.Repo.CommitID)), tplEditFile, &form)
} else if git.IsErrPushOutOfDate(err) {
- ctx.RenderWithErr(ctx.Tr("repo.editor.file_changed_while_editing", ctx.Repo.RepoLink+"/compare/"+util.PathEscapeSegments(form.LastCommit)+"..."+util.PathEscapeSegments(form.NewBranchName)), tplEditFile, &form)
+ ctx.RenderWithErr(ctx.Tr("repo.editor.push_out_of_date", ctx.Repo.RepoLink+"/compare/"+util.PathEscapeSegments(form.LastCommit)+"..."+util.PathEscapeSegments(form.NewBranchName)), tplEditFile, &form)
} else if git.IsErrPushRejected(err) {
errPushRej := err.(*git.ErrPushRejected)
if len(errPushRej.Message) == 0 {