From b873ec2bcea6d7b6205925646275c27f7f157a93 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Mon, 3 Apr 2017 22:24:21 -0400 Subject: [PATCH] templates/repo/branches: hide pull request button if not allowed (#4377) --- gogs.go | 2 +- routers/repo/branch.go | 1 + templates/.VERSION | 2 +- templates/repo/branches/all.tmpl | 2 +- templates/repo/branches/overview.tmpl | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gogs.go b/gogs.go index 8b03a435..a3d9c3a1 100644 --- a/gogs.go +++ b/gogs.go @@ -16,7 +16,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.11.0.0403" +const APP_VER = "0.11.1.0403" func init() { setting.AppVer = APP_VER diff --git a/routers/repo/branch.go b/routers/repo/branch.go index 08b1b068..d9a45fba 100644 --- a/routers/repo/branch.go +++ b/routers/repo/branch.go @@ -61,6 +61,7 @@ func loadBranches(ctx *context.Context) []*Branch { } } + ctx.Data["AllowPullRequest"] = ctx.Repo.Repository.AllowsPulls() return branches } diff --git a/templates/.VERSION b/templates/.VERSION index 7d2fee28..9102c746 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.11.0.0403 \ No newline at end of file +0.11.1.0403 \ No newline at end of file diff --git a/templates/repo/branches/all.tmpl b/templates/repo/branches/all.tmpl index d374acaa..f962884d 100644 --- a/templates/repo/branches/all.tmpl +++ b/templates/repo/branches/all.tmpl @@ -19,7 +19,7 @@
{{if and (eq $.BranchName .Name) $.IsRepositoryWriter}} {{$.i18n.Tr "repo.branches.change_default_branch"}} - {{else if $.IsRepositoryAdmin}} + {{else if and $.IsRepositoryWriter $.AllowPullRequest}} {{$.i18n.Tr "repo.pulls.new"}} {{end}}
diff --git a/templates/repo/branches/overview.tmpl b/templates/repo/branches/overview.tmpl index be31e7f5..921bce24 100644 --- a/templates/repo/branches/overview.tmpl +++ b/templates/repo/branches/overview.tmpl @@ -35,7 +35,7 @@ {{$timeSince := TimeSince .Commit.Committer.When $.Lang}} {{$.i18n.Tr "repo.branches.updated_by" $timeSince .Commit.Committer.Name | Safe}} - {{if $.IsRepositoryWriter}} + {{if and $.IsRepositoryWriter $.AllowPullRequest}}
{{$.i18n.Tr "repo.pulls.new"}}