diff options
author | Gusted <williamzijl7@hotmail.com> | 2022-01-18 16:12:10 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-18 16:12:10 +0000 |
commit | 9dcf0bf6ecffc631efd2808702af7f4f4dd23ffc (patch) | |
tree | 0574e623ed47a498421b928c5b7a43dd24ce2c13 /templates | |
parent | 8156e0f8556f08e3577ada436945a3240b01a5ac (diff) | |
download | gitea-9dcf0bf6ecffc631efd2808702af7f4f4dd23ffc.tar.gz gitea-9dcf0bf6ecffc631efd2808702af7f4f4dd23ffc.zip |
Fix commit links on compare page (#18310)
* Fix commit links on compare page
- Use the correct repo link for each commit(the headrepo). As for
compare pages were baserepo != headrepo, it wouldn't have the correct
link.
Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/repo/commits_list.tmpl | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/templates/repo/commits_list.tmpl b/templates/repo/commits_list.tmpl index ad2e825e23..d43170e525 100644 --- a/templates/repo/commits_list.tmpl +++ b/templates/repo/commits_list.tmpl @@ -9,6 +9,7 @@ </tr> </thead> <tbody class="commit-list"> + {{$commitRepoLink := $.RepoLink}}{{if $.CommitRepoLink}}{{$commitRepoLink = $.CommitRepoLink}}{{end}} {{range .Commits}} <tr> <td class="author"> @@ -41,9 +42,9 @@ {{end}} {{end}} {{if $.PageIsWiki}} - <a href="{{$.RepoLink}}/wiki/commit/{{.ID}}" rel="nofollow" class="{{$class}}"> + <a href="{{$commitRepoLink}}/wiki/commit/{{.ID}}" rel="nofollow" class="{{$class}}"> {{else if $.Reponame}} - <a href="{{$.RepoLink}}/commit/{{.ID}}" rel="nofollow" class="{{$class}}"> + <a href="{{$commitRepoLink}}/commit/{{.ID}}" rel="nofollow" class="{{$class}}"> {{else}} <span class="{{$class}}"> {{end}} @@ -62,8 +63,8 @@ {{if $.PageIsWiki}} <span class="commit-summary {{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{.Summary | RenderEmoji}}</span> {{else }} - {{ $commitLink:= printf "%s/commit/%s" $.RepoLink (PathEscape .ID.String) }} - <span class="commit-summary {{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{RenderCommitMessageLinkSubject .Message $.RepoLink $commitLink $.Repository.ComposeMetas}}</span> + {{ $commitLink:= printf "%s/commit/%s" $commitRepoLink (PathEscape .ID.String) }} + <span class="commit-summary {{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{RenderCommitMessageLinkSubject .Message $commitRepoLink $commitLink $.Repository.ComposeMetas}}</span> {{end}} </span> {{if IsMultilineCommitMessage .Message}} @@ -71,7 +72,7 @@ {{end}} {{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses "root" $}} {{if IsMultilineCommitMessage .Message}} - <pre class="commit-body" style="display: none;">{{RenderCommitBody .Message $.RepoLink $.Repository.ComposeMetas}}</pre> + <pre class="commit-body" style="display: none;">{{RenderCommitBody .Message $commitRepoLink $.Repository.ComposeMetas}}</pre> {{end}} </td> <td class="text right aligned">{{TimeSince .Author.When $.Lang}}</td> |