Skip to content

Commit

Permalink
Only show "New Pull Request" button if repo allows pulls (go-gitea#7426)
Browse files Browse the repository at this point in the history
Signed-off-by: Gary Kim <gary@garykim.dev>
  • Loading branch information
gary-kim authored and jeffliu27 committed Jul 18, 2019
1 parent bdeed31 commit b2e9a72
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions routers/repo/branch.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func Branches(ctx *context.Context) {
ctx.Data["Title"] = "Branches"
ctx.Data["IsRepoToolbarBranches"] = true
ctx.Data["DefaultBranch"] = ctx.Repo.Repository.DefaultBranch
ctx.Data["AllowsPulls"] = ctx.Repo.Repository.AllowsPulls()
ctx.Data["IsWriter"] = ctx.Repo.CanWrite(models.UnitTypeCode)
ctx.Data["IsMirror"] = ctx.Repo.Repository.IsMirror
ctx.Data["PageIsViewCode"] = true
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/branch/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
</td>
<td class="right aligned">
{{if not .LatestPullRequest}}
{{if not .IsDeleted}}
{{if and (not .IsDeleted) $.AllowsPulls}}
<a href="{{$.RepoLink}}/compare/{{$.DefaultBranch | EscapePound}}...{{if ne $.Repository.Owner.Name $.Owner.Name}}{{$.Owner.Name}}:{{end}}{{.Name | EscapePound}}">
<button id="new-pull-request" class="ui compact basic button">{{$.i18n.Tr "repo.pulls.compare_changes"}}</button>
</a>
Expand Down

0 comments on commit b2e9a72

Please sign in to comment.