@@ -53,6 +53,7 @@ func renderCommitRights(ctx *context.Context) bool {
53
53
}
54
54
ctx .Data ["CanCommitToBranch" ] = canCommitToBranch
55
55
ctx .Data ["CanCreatePullRequest" ] = ctx .Repo .Repository .UnitEnabled (ctx , unit .TypePullRequests ) || canCreateBasePullRequest (ctx )
56
+ ctx .Data ["IsForkDefaultBranch" ] = canCreateBasePullRequest (ctx ) && ctx .Repo .BranchName == ctx .Repo .Repository .BaseRepo .DefaultBranch
56
57
57
58
return canCommitToBranch .CanCommitToBranch
58
59
}
@@ -184,7 +185,7 @@ func editFile(ctx *context.Context, isNewFile bool) {
184
185
ctx .Data ["BranchLink" ] = ctx .Repo .RepoLink + "/src/" + ctx .Repo .BranchNameSubURL ()
185
186
ctx .Data ["commit_summary" ] = ""
186
187
ctx .Data ["commit_message" ] = ""
187
- if canCommit {
188
+ if canCommit && ! canCreateBasePullRequest ( ctx ) {
188
189
ctx .Data ["commit_choice" ] = frmCommitChoiceDirect
189
190
} else {
190
191
ctx .Data ["commit_choice" ] = frmCommitChoiceNewBranch
@@ -443,7 +444,7 @@ func DeleteFile(ctx *context.Context) {
443
444
ctx .Data ["commit_summary" ] = ""
444
445
ctx .Data ["commit_message" ] = ""
445
446
ctx .Data ["last_commit" ] = ctx .Repo .CommitID
446
- if canCommit {
447
+ if canCommit && ! canCreateBasePullRequest ( ctx ) {
447
448
ctx .Data ["commit_choice" ] = frmCommitChoiceDirect
448
449
} else {
449
450
ctx .Data ["commit_choice" ] = frmCommitChoiceNewBranch
@@ -608,7 +609,7 @@ func UploadFile(ctx *context.Context) {
608
609
ctx .Data ["BranchLink" ] = ctx .Repo .RepoLink + "/src/" + ctx .Repo .BranchNameSubURL ()
609
610
ctx .Data ["commit_summary" ] = ""
610
611
ctx .Data ["commit_message" ] = ""
611
- if canCommit {
612
+ if canCommit && ! canCreateBasePullRequest ( ctx ) {
612
613
ctx .Data ["commit_choice" ] = frmCommitChoiceDirect
613
614
} else {
614
615
ctx .Data ["commit_choice" ] = frmCommitChoiceNewBranch
0 commit comments