Skip to content

Commit

Permalink
Use pulls url if issue is a pull request (go-gitea#16230)
Browse files Browse the repository at this point in the history
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 go-gitea#16102

Signed-off-by: Sebastian Sauer <sauer.sebastian@gmail.com>
  • Loading branch information
sebastian-sauer authored and AbdulrhmnGhanem committed Aug 10, 2021
1 parent fbaaee3 commit a1f97f1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion templates/repo/issue/view_content/context_menu.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down

0 comments on commit a1f97f1

Please sign in to comment.