diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2023-02-07 02:09:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-06 12:09:18 -0600 |
commit | 769be877f2ce572b94b7c0a85853a2f7836075ac (patch) | |
tree | 05b203548fe61dbb6c95b5ffec2da6915a84df34 /templates/shared | |
parent | 189d5b7045b2200fa55c20707a39138cfb8cf0ed (diff) | |
download | gitea-769be877f2ce572b94b7c0a85853a2f7836075ac.tar.gz gitea-769be877f2ce572b94b7c0a85853a2f7836075ac.zip |
Use link in UI which returned a relative url but not html_url which contains an absolute url (#21986)
partially fix #19345
This PR add some `Link` methods for different objects. The `Link`
methods are not different from `HTMLURL`, they are lack of the absolute
URL. And most of UI `HTMLURL` have been replaced to `Link` so that users
can visit them from a different domain or IP.
This PR also introduces a new javascript configuration
`window.config.reqAppUrl` which is different from `appUrl` which is
still an absolute url but the domain has been replaced to the current
requested domain.
Diffstat (limited to 'templates/shared')
-rw-r--r-- | templates/shared/issuelist.tmpl | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl index 93d54930ff..9e3f605456 100644 --- a/templates/shared/issuelist.tmpl +++ b/templates/shared/issuelist.tmpl @@ -34,7 +34,7 @@ </div> <div class="issue-item-main f1 fc df"> <div class="issue-item-top-row"> - <a class="title tdn issue-title" href="{{if .HTMLURL}}{{.HTMLURL}}{{else}}{{$.Link}}/{{.Index}}{{end}}">{{RenderEmoji .Title | RenderCodeBlock}}</a> + <a class="title tdn issue-title" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}">{{RenderEmoji .Title | RenderCodeBlock}}</a> {{if .IsPull}} {{if (index $.CommitStatuses .PullRequest.ID)}} {{template "repo/commit_statuses" dict "Status" (index $.CommitLastStatus .PullRequest.ID) "Statuses" (index $.CommitStatuses .PullRequest.ID) "root" $}} @@ -47,7 +47,7 @@ </span> </div> <div class="desc issue-item-bottom-row df ac fw my-1"> - <a class="index ml-0 mr-2" href="{{if .HTMLURL}}{{.HTMLURL}}{{else}}{{$.Link}}/{{.Index}}{{end}}"> + <a class="index ml-0 mr-2" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}"> {{if eq $.listType "dashboard"}} {{.Repo.FullName}}#{{.Index}} {{else}} @@ -65,7 +65,7 @@ {{if .IsPull}} <div class="branches df ac"> <div class="branch"> - <a href="{{.PullRequest.BaseRepo.HTMLURL}}/src/branch/{{PathEscapeSegments .PullRequest.BaseBranch}}"> + <a href="{{.PullRequest.BaseRepo.Link}}/src/branch/{{PathEscapeSegments .PullRequest.BaseBranch}}"> {{/* inline to remove the spaces between spans */}} {{if ne .RepoID .PullRequest.BaseRepoID}}<span class="truncated-name">{{.PullRequest.BaseRepo.OwnerName}}</span>:{{end}}<span class="truncated-name">{{.PullRequest.BaseBranch}}</span> </a> @@ -73,7 +73,7 @@ {{svg "gitea-double-chevron-left" 12 "mx-1"}} {{if .PullRequest.HeadRepo}} <div class="branch"> - <a href="{{.PullRequest.HeadRepo.HTMLURL}}/src/branch/{{PathEscapeSegments .PullRequest.HeadBranch}}"> + <a href="{{.PullRequest.HeadRepo.Link}}/src/branch/{{PathEscapeSegments .PullRequest.HeadBranch}}"> {{/* inline to remove the spaces between spans */}} {{if ne .RepoID .PullRequest.HeadRepoID}}<span class="truncated-name">{{.PullRequest.HeadRepo.OwnerName}}</span>:{{end}}<span class="truncated-name">{{.PullRequest.HeadBranch}}</span> </a> @@ -159,7 +159,7 @@ </div> <div class="issue-item-icon-right text grey"> {{if .NumComments}} - <a class="tdn muted" href="{{if .HTMLURL}}{{.HTMLURL}}{{else}}{{$.Link}}/{{.Index}}{{end}}"> + <a class="tdn muted" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}"> {{svg "octicon-comment" 16 "mr-2"}}{{.NumComments}} </a> {{end}} |