summaryrefslogtreecommitdiffstats
path: root/routers/repo
diff options
context:
space:
mode:
authorguillep2k <18600385+guillep2k@users.noreply.github.com>2019-10-04 23:09:19 -0300
committerLunny Xiao <xiaolunwen@gmail.com>2019-10-05 10:09:19 +0800
commitfb7c23f911bebcb72f170f3d8bc8343546805f3b (patch)
treea208fe4a49be0c378ce9d91f224289c0c3fec388 /routers/repo
parentf92a0b68fed81128fa278e82aa0e3d49d74ffdf6 (diff)
downloadgitea-fb7c23f911bebcb72f170f3d8bc8343546805f3b.tar.gz
gitea-fb7c23f911bebcb72f170f3d8bc8343546805f3b.zip
Fix editor commit to new branch if PR disabled (#8375)
Diffstat (limited to 'routers/repo')
-rw-r--r--routers/repo/editor.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/routers/repo/editor.go b/routers/repo/editor.go
index 68b94662dc..d4a7dab074 100644
--- a/routers/repo/editor.go
+++ b/routers/repo/editor.go
@@ -269,7 +269,7 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo
}
}
- if form.CommitChoice == frmCommitChoiceNewBranch {
+ if form.CommitChoice == frmCommitChoiceNewBranch && ctx.Repo.Repository.UnitEnabled(models.UnitTypePullRequests) {
ctx.Redirect(ctx.Repo.RepoLink + "/compare/" + ctx.Repo.BranchName + "..." + form.NewBranchName)
} else {
ctx.Redirect(ctx.Repo.RepoLink + "/src/branch/" + util.PathEscapeSegments(branchName) + "/" + util.PathEscapeSegments(form.TreePath))
@@ -434,7 +434,7 @@ func DeleteFilePost(ctx *context.Context, form auth.DeleteRepoFileForm) {
}
ctx.Flash.Success(ctx.Tr("repo.editor.file_delete_success", ctx.Repo.TreePath))
- if form.CommitChoice == frmCommitChoiceNewBranch {
+ if form.CommitChoice == frmCommitChoiceNewBranch && ctx.Repo.Repository.UnitEnabled(models.UnitTypePullRequests) {
ctx.Redirect(ctx.Repo.RepoLink + "/compare/" + ctx.Repo.BranchName + "..." + form.NewBranchName)
} else {
treePath := filepath.Dir(ctx.Repo.TreePath)
@@ -589,7 +589,7 @@ func UploadFilePost(ctx *context.Context, form auth.UploadRepoFileForm) {
return
}
- if form.CommitChoice == frmCommitChoiceNewBranch {
+ if form.CommitChoice == frmCommitChoiceNewBranch && ctx.Repo.Repository.UnitEnabled(models.UnitTypePullRequests) {
ctx.Redirect(ctx.Repo.RepoLink + "/compare/" + ctx.Repo.BranchName + "..." + form.NewBranchName)
} else {
ctx.Redirect(ctx.Repo.RepoLink + "/src/branch/" + util.PathEscapeSegments(branchName) + "/" + util.PathEscapeSegments(form.TreePath))