mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-08 22:13:26 +09:00
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:
co-authored by
wxiaoguang
parent
60326ca03d
commit
e806566b39
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user