forked from tangled.org/core
Monorepo for Tangled

appview: pulls: fix commit links in format-patch submissions

the conditionals here were a bit confusing, branch-based PRs just
skipped commit links altogether.

authored by oppi.li and committed by Tangled b1d5f1b3 92128df9

Changed files
+11 -10
appview
pages
templates
repo
pulls
+11 -10
appview/pages/templates/repo/pulls/pull.html
··· 88 88 <div class="flex items-center gap-2"> 89 89 {{ i "git-commit-horizontal" "w-4 h-4" }} 90 90 <div class="text-sm text-gray-500 dark:text-gray-400"> 91 - {{ if not $.Pull.IsPatchBased }} 92 - {{ $fullRepo := $.RepoInfo.FullName }} 93 - {{ if $.Pull.IsForkBased }} 94 - {{ if $.Pull.PullSource.Repo }} 95 - {{ $fullRepo = printf "%s/%s" $owner $.Pull.PullSource.Repo.Name }} 96 - <a href="/{{ $fullRepo }}/commit/{{ .SHA }}" class="font-mono text-gray-500 dark:text-gray-400">{{ slice .SHA 0 8 }}</a> 97 - {{ else }} 98 - <span class="font-mono">{{ slice .SHA 0 8 }}</span> 99 - {{ end }} 100 - {{ end }} 91 + <!-- attempt to resolve $fullRepo: this is possible only on non-deleted forks and branches --> 92 + {{ $fullRepo := "" }} 93 + {{ if and $.Pull.IsForkBased $.Pull.PullSource.Repo }} 94 + {{ $fullRepo = printf "%s/%s" $owner $.Pull.PullSource.Repo.Name }} 95 + {{ else if $.Pull.IsBranchBased }} 96 + {{ $fullRepo = $.RepoInfo.FullName }} 97 + {{ end }} 98 + 99 + <!-- if $fullRepo was resolved, link to it, otherwise just span without a link --> 100 + {{ if $fullRepo }} 101 + <a href="/{{ $fullRepo }}/commit/{{ .SHA }}" class="font-mono text-gray-500 dark:text-gray-400">{{ slice .SHA 0 8 }}</a> 101 102 {{ else }} 102 103 <span class="font-mono">{{ slice .SHA 0 8 }}</span> 103 104 {{ end }}