Skip to content

Commit 2477737

Browse files
gary-kimlunny
authored andcommitted
Only show "New Pull Request" button if repo allows pulls (#7426) (#7432)
Signed-off-by: Gary Kim <[email protected]>
1 parent a360dae commit 2477737

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

routers/repo/branch.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ func Branches(ctx *context.Context) {
3939
ctx.Data["Title"] = "Branches"
4040
ctx.Data["IsRepoToolbarBranches"] = true
4141
ctx.Data["DefaultBranch"] = ctx.Repo.Repository.DefaultBranch
42+
ctx.Data["AllowsPulls"] = ctx.Repo.Repository.AllowsPulls()
4243
ctx.Data["IsWriter"] = ctx.Repo.CanWrite(models.UnitTypeCode)
4344
ctx.Data["IsMirror"] = ctx.Repo.Repository.IsMirror
4445
ctx.Data["PageIsViewCode"] = true

templates/repo/branch/list.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
</td>
6464
<td class="right aligned">
6565
{{if not .LatestPullRequest}}
66-
{{if not .IsDeleted}}
66+
{{if and (not .IsDeleted) $.AllowsPulls}}
6767
<a href="{{$.RepoLink}}/compare/{{$.DefaultBranch | EscapePound}}...{{if ne $.Repository.Owner.Name $.Owner.Name}}{{$.Owner.Name}}:{{end}}{{.Name | EscapePound}}">
6868
<button id="new-pull-request" class="ui compact basic button">{{$.i18n.Tr "repo.pulls.compare_changes"}}</button>
6969
</a>

0 commit comments

Comments
 (0)