Skip to content

Commit db55c40

Browse files
committed
Fix branch page pull request title and link error (go-gitea#10092)
* Fix branch page pull request title and link error * Fix ui
1 parent 158b716 commit db55c40

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

routers/repo/branch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ func loadBranches(ctx *context.Context) []*Branch {
221221
} else {
222222
repoIDToRepo[pr.BaseRepoID] = pr.BaseRepo
223223
}
224+
pr.Issue.Repo = pr.BaseRepo
224225

225226
if pr.HasMerged {
226227
baseGitRepo, ok := repoIDToGitRepo[pr.BaseRepoID]
@@ -243,7 +244,6 @@ func loadBranches(ctx *context.Context) []*Branch {
243244
mergeMovedOn = true
244245
}
245246
}
246-
247247
}
248248

249249
branches[i] = &Branch{

templates/repo/branch/list.tmpl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
</div>
7474
{{end}}
7575
</td>
76-
<td class="two wide right aligned">
76+
<td class="three wide right aligned">
7777
{{if not .LatestPullRequest}}
7878
{{if and (not .IsDeleted) $.AllowsPulls (gt .CommitsAhead 0)}}
7979
<a href="{{$.RepoLink}}/compare/{{$.DefaultBranch | EscapePound}}...{{if ne $.Repository.Owner.Name $.Owner.Name}}{{$.Owner.Name}}:{{end}}{{.Name | EscapePound}}">
@@ -87,13 +87,13 @@
8787
</a>
8888
{{end}}
8989
{{else}}
90-
<a href="{{$.RepoLink}}/pulls/{{.LatestPullRequest.Issue.Index}}">#{{.LatestPullRequest.Issue.Index}}</a>
90+
<a href="{{.LatestPullRequest.Issue.HTMLURL}}">{{if not .LatestPullRequest.IsSameRepo}}{{.LatestPullRequest.BaseRepo.FullName}}{{end}}#{{.LatestPullRequest.Issue.Index}}</a>
9191
{{if .LatestPullRequest.HasMerged}}
92-
<a href="{{$.RepoLink}}/pulls/{{.LatestPullRequest.Issue.Index}}" class="ui purple small label"><i class="octicon octicon-git-pull-request"></i> {{$.i18n.Tr "repo.pulls.merged"}}</a>
92+
<a href="{{.LatestPullRequest.Issue.HTMLURL}}" class="ui purple mini label"><i class="octicon octicon-git-pull-request"></i> {{$.i18n.Tr "repo.pulls.merged"}}</a>
9393
{{else if .LatestPullRequest.Issue.IsClosed}}
94-
<a href="{{$.RepoLink}}/pulls/{{.LatestPullRequest.Issue.Index}}" class="ui red small label"><i class="octicon octicon-issue-closed"></i> {{$.i18n.Tr "repo.issues.closed_title"}}</a>
94+
<a href="{{.LatestPullRequest.Issue.HTMLURL}}" class="ui red mini label"><i class="octicon octicon-issue-closed"></i> {{$.i18n.Tr "repo.issues.closed_title"}}</a>
9595
{{else}}
96-
<a href="{{$.RepoLink}}/pulls/{{.LatestPullRequest.Issue.Index}}" class="ui green small label"><i class="octicon octicon-issue-opened"></i> {{$.i18n.Tr "repo.issues.open_title"}}</a>
96+
<a href="{{.LatestPullRequest.Issue.HTMLURL}}" class="ui green mini label"><i class="octicon octicon-issue-opened"></i> {{$.i18n.Tr "repo.issues.open_title"}}</a>
9797
{{end}}
9898
{{end}}
9999
</td>

0 commit comments

Comments
 (0)