aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--routers/repo/issue.go7
-rw-r--r--templates/repo/pulls/commits.tmpl2
-rw-r--r--templates/repo/pulls/files.tmpl2
3 files changed, 8 insertions, 3 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 45e63dd9c3..a4efb68024 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -51,6 +51,8 @@ func MustEnablePulls(ctx *middleware.Context) {
if !ctx.Repo.Repository.EnablePulls {
ctx.Handle(404, "MustEnablePulls", nil)
}
+
+ ctx.Data["HasForkedRepo"] = ctx.IsSigned && ctx.User.HasForkedRepo(ctx.Repo.Repository.ID)
}
func RetrieveLabels(ctx *middleware.Context) {
@@ -69,9 +71,12 @@ func RetrieveLabels(ctx *middleware.Context) {
func Issues(ctx *middleware.Context) {
isPullList := ctx.Params(":type") == "pulls"
if isPullList {
+ MustEnablePulls(ctx)
+ if ctx.Written() {
+ return
+ }
ctx.Data["Title"] = ctx.Tr("repo.pulls")
ctx.Data["PageIsPullList"] = true
- ctx.Data["HasForkedRepo"] = ctx.IsSigned && ctx.User.HasForkedRepo(ctx.Repo.Repository.ID)
} else {
MustEnableIssues(ctx)
diff --git a/templates/repo/pulls/commits.tmpl b/templates/repo/pulls/commits.tmpl
index 5095009a9e..469499ae84 100644
--- a/templates/repo/pulls/commits.tmpl
+++ b/templates/repo/pulls/commits.tmpl
@@ -5,7 +5,7 @@
<div class="navbar">
{{template "repo/issue/navbar" .}}
<div class="ui right">
- <a class="ui green button" href="{{$.RepoLink}}/issues/new">{{.i18n.Tr "repo.issues.new"}}</a>
+ <a class="ui green button {{if not .HasForkedRepo}}disabled{{end}}" href="{{.RepoLink}}/compare/{{.BranchName}}...{{.SignedUserName}}:{{.BranchName}}">{{.i18n.Tr "repo.pulls.new"}}</a>
</div>
</div>
<div class="ui divider"></div>
diff --git a/templates/repo/pulls/files.tmpl b/templates/repo/pulls/files.tmpl
index 9070112e53..14ef29037b 100644
--- a/templates/repo/pulls/files.tmpl
+++ b/templates/repo/pulls/files.tmpl
@@ -5,7 +5,7 @@
<div class="navbar">
{{template "repo/issue/navbar" .}}
<div class="ui right">
- <a class="ui green button" href="{{$.RepoLink}}/issues/new">{{.i18n.Tr "repo.issues.new"}}</a>
+ <a class="ui green button {{if not .HasForkedRepo}}disabled{{end}}" href="{{.RepoLink}}/compare/{{.BranchName}}...{{.SignedUserName}}:{{.BranchName}}">{{.i18n.Tr "repo.pulls.new"}}</a>
</div>
</div>
<div class="ui divider"></div>