mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-29 20:13:27 +00:00
769be877f2
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.
92 lines
3.4 KiB
Handlebars
92 lines
3.4 KiB
Handlebars
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<title>{{.Subject}}</title>
|
|
|
|
<style>
|
|
blockquote { padding-left: 1em; margin: 1em 0; border-left: 1px solid grey; color: #777}
|
|
.footer { font-size:small; color:#666;}
|
|
{{if .ReviewComments}}
|
|
.review { padding-left: 1em; margin: 1em 0; }
|
|
.review > pre { padding: 1em; border-left: 1px solid grey; }
|
|
{{end}}
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
{{if .IsMention}}<p>{{.locale.Tr "mail.issue.x_mentioned_you" .Doer.Name | Str2html}}</p>{{end}}
|
|
{{if eq .ActionName "push"}}
|
|
<p>
|
|
{{if .Comment.IsForcePush}}
|
|
{{$oldCommitUrl := printf "%s/commit/%s" .Comment.Issue.PullRequest.BaseRepo.Link .Comment.OldCommit}}
|
|
{{$oldShortSha := ShortSha .Comment.OldCommit}}
|
|
{{$oldCommitLink := printf "<a href='%[1]s'><b>%[2]s</b></a>" (Escape $oldCommitUrl) (Escape $oldShortSha)}}
|
|
|
|
{{$newCommitUrl := printf "%s/commit/%s" .Comment.Issue.PullRequest.BaseRepo.Link .Comment.NewCommit}}
|
|
{{$newShortSha := ShortSha .Comment.NewCommit}}
|
|
{{$newCommitLink := printf "<a href='%[1]s'><b>%[2]s</b></a>" (Escape $newCommitUrl) (Escape $newShortSha)}}
|
|
|
|
{{.locale.Tr "mail.issue.action.force_push" .Doer.Name .Comment.Issue.PullRequest.HeadBranch $oldCommitLink $newCommitLink | Str2html}}
|
|
{{else}}
|
|
{{.locale.TrN (len .Comment.Commits) "mail.issue.action.push_1" "mail.issue.action.push_n" .Doer.Name .Comment.Issue.PullRequest.HeadBranch (len .Comment.Commits) | Str2html}}
|
|
{{end}}
|
|
</p>
|
|
{{end}}
|
|
<p>
|
|
{{if eq .ActionName "close"}}
|
|
{{.locale.Tr "mail.issue.action.close" (Escape .Doer.Name) .Issue.Index | Str2html}}
|
|
{{else if eq .ActionName "reopen"}}
|
|
{{.locale.Tr "mail.issue.action.reopen" (Escape .Doer.Name) .Issue.Index | Str2html}}
|
|
{{else if eq .ActionName "merge"}}
|
|
{{.locale.Tr "mail.issue.action.merge" (Escape .Doer.Name) .Issue.Index (Escape .Issue.PullRequest.BaseBranch) | Str2html}}
|
|
{{else if eq .ActionName "approve"}}
|
|
{{.locale.Tr "mail.issue.action.approve" (Escape .Doer.Name) | Str2html}}
|
|
{{else if eq .ActionName "reject"}}
|
|
{{.locale.Tr "mail.issue.action.reject" (Escape .Doer.Name) | Str2html}}
|
|
{{else if eq .ActionName "review"}}
|
|
{{.locale.Tr "mail.issue.action.review" (Escape .Doer.Name) | Str2html}}
|
|
{{else if eq .ActionName "review_dismissed"}}
|
|
{{.locale.Tr "mail.issue.action.review_dismissed" (Escape .Doer.Name) (Escape .Comment.Review.Reviewer.Name) | Str2html}}
|
|
{{else if eq .ActionName "ready_for_review"}}
|
|
{{.locale.Tr "mail.issue.action.ready_for_review" (Escape .Doer.Name) | Str2html}}
|
|
{{end}}
|
|
|
|
{{- if eq .Body ""}}
|
|
{{if eq .ActionName "new"}}
|
|
{{.locale.Tr "mail.issue.action.new" (Escape .Doer.Name) .Issue.Index | Str2html}}
|
|
{{end}}
|
|
{{else}}
|
|
{{.Body | Str2html}}
|
|
{{end -}}
|
|
{{- range .ReviewComments}}
|
|
<hr>
|
|
{{$.locale.Tr "mail.issue.in_tree_path" .TreePath}}
|
|
<div class="review">
|
|
<pre>{{.Patch}}</pre>
|
|
<div>{{.RenderedContent | Safe}}</div>
|
|
</div>
|
|
{{end -}}
|
|
{{if eq .ActionName "push"}}
|
|
<ul>
|
|
{{range .Comment.Commits}}
|
|
<li>
|
|
<a href="{{$.Comment.Issue.PullRequest.BaseRepo.Link}}/commit/{{.ID}}">
|
|
{{ShortSha .ID.String}}
|
|
</a> - {{.Summary}}
|
|
</li>
|
|
{{end}}
|
|
</ul>
|
|
{{end}}
|
|
</p>
|
|
<div class="footer">
|
|
<p>
|
|
---
|
|
<br>
|
|
<a href="{{.Link}}">{{.locale.Tr "mail.view_it_on" AppName}}</a>{{if .CanReply}} {{.locale.Tr "mail.reply"}}{{end}}.
|
|
</p>
|
|
</div>
|
|
</body>
|
|
</html>
|