]> source.dussan.org Git - gitea.git/commitdiff
Only show "New Pull Request" button if repo allows pulls (#7426)
authorGary Kim <gary@garykim.dev>
Thu, 11 Jul 2019 20:21:16 +0000 (20:21 +0000)
committertechknowlogick <techknowlogick@gitea.io>
Thu, 11 Jul 2019 20:21:16 +0000 (16:21 -0400)
Signed-off-by: Gary Kim <gary@garykim.dev>
routers/repo/branch.go
templates/repo/branch/list.tmpl

index 708b33be09bd67f0fd1841d33cd98137baccfe26..3bd4a75bfb3c040f38535324e0b8560e41e05250 100644 (file)
@@ -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
index a2fb5c20697f36251342e901c9748f9fc402a09f..2028797bdb9bc5dd2f28a56c6ee06d3bfd9764c5 100644 (file)
@@ -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>