summaryrefslogtreecommitdiffstats
path: root/templates/mail/issue/default.tmpl
blob: c48797d82780b19f45e30d9e88872a9ab68d6e76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!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}}</p>{{end}}
	{{if eq .ActionName "push"}}
		<p>
			{{if .Comment.IsForcePush}}
				{{$oldCommitUrl := printf "%s/commit/%s" .Comment.Issue.PullRequest.BaseRepo.HTMLURL .Comment.OldCommit}}
				{{$oldShortSha := ShortSha .Comment.OldCommit}}
				{{$oldCommitLink := HTMLFormat "<a href='%[1]s'><b>%[2]s</b></a>" $oldCommitUrl $oldShortSha}}

				{{$newCommitUrl := printf "%s/commit/%s" .Comment.Issue.PullRequest.BaseRepo.HTMLURL .Comment.NewCommit}}
				{{$newShortSha := ShortSha .Comment.NewCommit}}
				{{$newCommitLink := HTMLFormat "<a href='%[1]s'><b>%[2]s</b></a>" $newCommitUrl $newShortSha}}

				{{.locale.Tr "mail.issue.action.force_push" .Doer.Name .Comment.Issue.PullRequest.HeadBranch $oldCommitLink $newCommitLink}}
			{{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)}}
			{{end}}
		</p>
	{{end}}
	<p>
		{{if eq .ActionName "close"}}
			{{.locale.Tr "mail.issue.action.close" (Escape .Doer.Name) .Issue.Index}}
		{{else if eq .ActionName "reopen"}}
			{{.locale.Tr "mail.issue.action.reopen" (Escape .Doer.Name) .Issue.Index}}
		{{else if eq .ActionName "merge"}}
			{{.locale.Tr "mail.issue.action.merge" (Escape .Doer.Name) .Issue.Index (Escape .Issue.PullRequest.BaseBranch)}}
		{{else if eq .ActionName "approve"}}
			{{.locale.Tr "mail.issue.action.approve" (Escape .Doer.Name)}}
		{{else if eq .ActionName "reject"}}
			{{.locale.Tr "mail.issue.action.reject" (Escape .Doer.Name)}}
		{{else if eq .ActionName "review"}}
			{{.locale.Tr "mail.issue.action.review" (Escape .Doer.Name)}}
		{{else if eq .ActionName "review_dismissed"}}
			{{.locale.Tr "mail.issue.action.review_dismissed" (Escape .Doer.Name) (Escape .Comment.Review.Reviewer.Name)}}
		{{else if eq .ActionName "ready_for_review"}}
			{{.locale.Tr "mail.issue.action.ready_for_review" (Escape .Doer.Name)}}
		{{end}}

		{{- if eq .Body ""}}
			{{if eq .ActionName "new"}}
				{{.locale.Tr "mail.issue.action.new" (Escape .Doer.Name) .Issue.Index}}
			{{end}}
		{{else}}
			{{.Body | Str2html}}
		{{end -}}
		{{- range .ReviewComments}}
			<hr>
			{{$.locale.Tr "mail.issue.in_tree_path" .TreePath}}
			<div class="review">
				<pre>{{.Patch}}</pre>
				<div>{{.RenderedContent | SafeHTML}}</div>
			</div>
		{{end -}}
		{{if eq .ActionName "push"}}
			<ul>
			{{range .Comment.Commits}}
				<li>
					<a href="{{$.Comment.Issue.PullRequest.BaseRepo.HTMLURL}}/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>