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>
tokarchuk/v1.17
sebastian-sauer 3 years ago committed by GitHub
parent d55b5eb0d3
commit 66f8da538a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      templates/repo/issue/view_content/context_menu.tmpl

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

Loading…
Cancel
Save