Skip to content

Commit f2fc205

Browse files
committed
Fix translation lookup error due to missing WontSignReason
1 parent 6ba37a0 commit f2fc205

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

routers/web/repo/editor.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,24 +47,24 @@ func canCreateBasePullRequest(ctx *context.Context, editRepo *repo_model.Reposit
4747
}
4848

4949
func renderCommitRights(ctx *context.Context, editRepo *repo_model.Repository) bool {
50+
canCommitToBranch, err := context.CanCommitToBranch(ctx, ctx.Doer, editRepo, ctx.Repo.BranchName)
51+
if err != nil {
52+
log.Error("CanCommitToBranch: %v", err)
53+
}
54+
5055
if editRepo.ID == ctx.Repo.Repository.ID {
5156
// Editing the same repository that we are viewing
52-
canCommitToBranch, err := context.CanCommitToBranch(ctx, ctx.Doer, ctx.Repo.Repository, ctx.Repo.BranchName)
53-
if err != nil {
54-
log.Error("CanCommitToBranch: %v", err)
55-
}
56-
57-
ctx.Data["CanCommitToBranch"] = canCommitToBranch
5857
ctx.Data["CanCreatePullRequest"] = ctx.Repo.Repository.UnitEnabled(ctx, unit.TypePullRequests) || canCreateBasePullRequest(ctx, editRepo)
59-
60-
return canCommitToBranch.CanCommitToBranch
58+
} else {
59+
// Editing a user fork of the repository we are viewing, always choose a new branch
60+
canCommitToBranch.CanCommitToBranch = false
61+
canCommitToBranch.UserCanPush = false
62+
ctx.Data["CanCreatePullRequest"] = canCreateBasePullRequest(ctx, editRepo)
6163
}
6264

63-
// Editing a user fork of the repository we are viewing, always choose a new branch
64-
ctx.Data["CanCommitToBranch"] = context.CanCommitToBranchResults{}
65-
ctx.Data["CanCreatePullRequest"] = canCreateBasePullRequest(ctx, editRepo)
65+
ctx.Data["CanCommitToBranch"] = canCommitToBranch
6666

67-
return false
67+
return canCommitToBranch.CanCommitToBranch
6868
}
6969

7070
// redirectForCommitChoice redirects after committing the edit to a branch

0 commit comments

Comments
 (0)