fix(web): populate the reason for "cannot commit to branch" in web editor commit form (#39155)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Nitish-1303
2026-08-28 21:46:58 +00:00
committed by GitHub
co-authored by wxiaoguang
parent 60326ca03d
commit e806566b39
12 changed files with 54 additions and 51 deletions
+1 -1
View File
@@ -67,7 +67,7 @@ func prepareEditorPageFormOptions(ctx *context.Context, editorAction string) *co
return nil
}
if commitFormOptions.WillSubmitToFork && !commitFormOptions.TargetRepo.CanEnableEditor() {
if commitFormOptions.WillSubmitToFork && !commitFormOptions.TargetRepo.CanContentChange() {
ctx.Data["NotFoundPrompt"] = ctx.Locale.Tr("repo.editor.fork_not_editable")
ctx.NotFound(nil)
}
+1 -1
View File
@@ -49,7 +49,7 @@ func MustBeNotEmpty(ctx *context.Context) {
// MustBeEditable check that repo can be edited
func MustBeEditable(ctx *context.Context) {
if !ctx.Repo.Repository.CanEnableEditor() {
if !ctx.Repo.Repository.CanContentChange() {
ctx.NotFound(nil)
return
}
+1 -1
View File
@@ -255,7 +255,7 @@ func prepareFileView(ctx *context.Context, entry *git.TreeEntry) {
func prepareFileViewEditorButtons(ctx *context.Context) bool {
// archived or mirror repository, the buttons should not be shown
if !ctx.Repo.Repository.CanEnableEditor() {
if !ctx.Repo.Repository.CanContentChange() {
return true
}
+1 -1
View File
@@ -220,7 +220,7 @@ func prepareToRenderReadmeFile(ctx *context.Context, subfolder string, readmeFil
ctx.Data["EscapeStatus"], ctx.Data["FileContent"] = charset.EscapeControlHTML(template.HTML(contentEscaped), ctx.Locale)
}
if !fInfo.isLFSFile() && ctx.Repo.Repository.CanEnableEditor() {
if !fInfo.isLFSFile() && ctx.Repo.Repository.CanContentChange() {
ctx.Data["CanEditReadmeFile"] = true
}
}