From ff9daa3e9be55ed5942ff161973fa1f747ab5b7e Mon Sep 17 00:00:00 2001 From: Lunny Xiao <xiaolunwen@gmail.com> Date: Mon, 6 Nov 2017 03:11:35 +0800 Subject: [PATCH] fix click create pull request button 404 (#2859) --- modules/context/repo.go | 1 + templates/repo/home.tmpl | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/context/repo.go b/modules/context/repo.go index c61010ecba..883a826e44 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -424,6 +424,7 @@ func RepoAssignment() macaron.Handler { return } } + ctx.Data["IsForkedRepo"] = repo.IsFork // People who have push access or have forked repository can propose a new pull request. if ctx.Repo.IsWriter() || (ctx.IsSigned && ctx.User.HasForkedRepo(ctx.Repo.Repository.ID)) { diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index c7c88aafcc..0db8f37320 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -27,7 +27,7 @@ <div class="ui secondary menu"> {{if .PullRequestCtx.Allowed}} <div class="fitted item"> - <a href="{{.BaseRepo.Link}}/compare/{{.BaseRepo.DefaultBranch}}...{{if .SignedUser.HasForkedRepo .BaseRepo.ID }}{{.SignedUser.Name}}:{{end}}{{.BranchName}}"> + <a href="{{.BaseRepo.Link}}/compare/{{.BaseRepo.DefaultBranch}}...{{if .IsForkedRepo}}{{.Repository.Owner.Name}}:{{else}}{{if .SignedUser.HasForkedRepo .BaseRepo.ID}}{{.SignedUser.Name}}:{{end}}{{end}}{{.BranchName}}"> <button class="ui green tiny compact button"><i class="octicon octicon-git-compare"></i></button> </a> </div>