From 73610df584c11eafe582ffa98873c392659c4e2b Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sat, 1 Feb 2020 21:54:25 +0800 Subject: [PATCH 1/2] Fix branch page pull request title and link error (#10092) * Fix branch page pull request title and link error * Fix ui --- routers/repo/branch.go | 2 +- templates/repo/branch/list.tmpl | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/routers/repo/branch.go b/routers/repo/branch.go index df6e0bf21f6c7..d00f0e06025a4 100644 --- a/routers/repo/branch.go +++ b/routers/repo/branch.go @@ -238,6 +238,7 @@ func loadBranches(ctx *context.Context) []*Branch { } else { repoIDToRepo[pr.BaseRepoID] = pr.BaseRepo } + pr.Issue.Repo = pr.BaseRepo if pr.HasMerged { baseGitRepo, ok := repoIDToGitRepo[pr.BaseRepoID] @@ -260,7 +261,6 @@ func loadBranches(ctx *context.Context) []*Branch { mergeMovedOn = true } } - } isIncluded := divergence.Ahead == 0 && ctx.Repo.Repository.DefaultBranch != branchName diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index 073516f25fe6e..a24360795eb54 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -73,7 +73,7 @@ {{end}} - + {{if not .LatestPullRequest}} {{if .IsIncluded}} @@ -91,13 +91,13 @@ {{end}} {{else}} - #{{.LatestPullRequest.Issue.Index}} + {{if not .LatestPullRequest.IsSameRepo}}{{.LatestPullRequest.BaseRepo.FullName}}{{end}}#{{.LatestPullRequest.Issue.Index}} {{if .LatestPullRequest.HasMerged}} - {{$.i18n.Tr "repo.pulls.merged"}} + {{$.i18n.Tr "repo.pulls.merged"}} {{else if .LatestPullRequest.Issue.IsClosed}} - {{$.i18n.Tr "repo.issues.closed_title"}} + {{$.i18n.Tr "repo.issues.closed_title"}} {{else}} - {{$.i18n.Tr "repo.issues.open_title"}} + {{$.i18n.Tr "repo.issues.open_title"}} {{end}} {{end}} From fd8a3054db1c3ab2abb13daec5a8a64093863890 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sat, 1 Feb 2020 22:39:47 +0800 Subject: [PATCH 2/2] Fix tmpl --- templates/repo/branch/list.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index a24360795eb54..5244bf83e7f8d 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -91,7 +91,7 @@ {{end}} {{else}} - {{if not .LatestPullRequest.IsSameRepo}}{{.LatestPullRequest.BaseRepo.FullName}}{{end}}#{{.LatestPullRequest.Issue.Index}} + {{if ne .LatestPullRequest.BaseRepoID .LatestPullRequest.HeadRepoID}}{{.LatestPullRequest.BaseRepo.FullName}}{{end}}#{{.LatestPullRequest.Issue.Index}} {{if .LatestPullRequest.HasMerged}} {{$.i18n.Tr "repo.pulls.merged"}} {{else if .LatestPullRequest.Issue.IsClosed}}