Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-28 04:36:11 +01:00

Use pulls url if issue is a pull request (#16230)

if a pull request is displayed use the /pulls path
if a pull requests diff is displayed use the /pulls/{id}/files url
if an issue is displayed use the issues url

Fixes #16102

Signed-off-by: Sebastian Sauer <sauer.sebastian@gmail.com>
This commit is contained in:
sebastian-sauer 2021-06-22 22:13:31 +02:00 committed by GitHub
parent d55b5eb0d3
commit 66f8da538a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,7 +6,11 @@
<div class="menu"> <div class="menu">
{{ $referenceUrl := "" }} {{ $referenceUrl := "" }}
{{ if .issue }} {{ if .issue }}
{{ $referenceUrl = Printf "%s%s/issues/%d#%s" AppUrl .ctx.Repository.FullName .ctx.Issue.Index .item.HashTag }} {{ if .ctx.Issue.IsPull}}
{{ $referenceUrl = Printf "%s%s/pulls/%d#%s" AppUrl .ctx.Repository.FullName .ctx.Issue.Index .item.HashTag }}
{{ else }}
{{ $referenceUrl = Printf "%s%s/issues/%d#%s" AppUrl .ctx.Repository.FullName .ctx.Issue.Index .item.HashTag }}
{{ end }}
{{ else }} {{ else }}
{{ $referenceUrl = Printf "%s%s/pulls/%d/files#%s" AppUrl .ctx.Repository.FullName .ctx.Issue.Index .item.HashTag }} {{ $referenceUrl = Printf "%s%s/pulls/%d/files#%s" AppUrl .ctx.Repository.FullName .ctx.Issue.Index .item.HashTag }}
{{ end }} {{ end }}