appview/pulls: add link to PR source branch #678

merged
opened by boltless.me targeting master from push-lxmtmnwovxxn

small feature. tested for all PR types (patch, branch, fork-branch)

Changed files
+11 -9
appview
pages
templates
repo
pulls
fragments
+11 -9
appview/pages/templates/repo/pulls/fragments/pullHeader.html
···
{{ if not .Pull.IsPatchBased }}
from
<span class="text-xs rounded bg-gray-100 dark:bg-gray-700 text-black dark:text-white font-mono px-2 mx-1/2 inline-flex items-center">
-
{{ if .Pull.IsForkBased }}
-
{{ if .Pull.PullSource.Repo }}
-
{{ $owner := resolve .Pull.PullSource.Repo.Did }}
-
<a href="/{{ $owner }}/{{ .Pull.PullSource.Repo.Name }}" class="no-underline hover:underline">{{ $owner }}/{{ .Pull.PullSource.Repo.Name }}</a>:
-
{{- else -}}
-
<span class="italic">[deleted fork]</span>
-
{{- end -}}
-
{{- end -}}
-
{{- .Pull.PullSource.Branch -}}
+
{{ if not .Pull.IsForkBased }}
+
{{ $repoPath := .RepoInfo.FullName }}
+
<a href="/{{ $repoPath }}/tree/{{ pathEscape .Pull.PullSource.Branch }}" class="no-underline hover:underline">{{ .Pull.PullSource.Branch }}</a>
+
{{ else if .Pull.PullSource.Repo }}
+
{{ $repoPath := print (resolve .Pull.PullSource.Repo.Did) "/" .Pull.PullSource.Repo.Name }}
+
<a href="/{{ $repoPath }}" class="no-underline hover:underline">{{ $repoPath }}</a>:
+
<a href="/{{ $repoPath }}/tree/{{ pathEscape .Pull.PullSource.Branch }}" class="no-underline hover:underline">{{ .Pull.PullSource.Branch }}</a>
+
{{ else }}
+
<span class="italic">[deleted fork]</span>:
+
{{ .Pull.PullSource.Branch }}
+
{{ end }}
</span>
{{ end }}
</span>