Files
GiteaMailTemplates/themes/terra/mail/repo/issue/default.tmpl
T
KenanZhuandClaude f33cad7a7e fix: update push commit data paths for Gitea 1.27.1 compatibility
Gitea 1.27.1 fixed the mail template for push events (#38467) —
commit data must now be accessed via .UserCommit.GitCommit instead
of directly on the commit object.

Changed across all 10 themes:
- {{.ID}}               → {{.UserCommit.GitCommit.ID}}
- {{.ID.String}}        → {{.UserCommit.GitCommit.ID.String}}
- {{.MessageTitle}}     → {{.UserCommit.GitCommit.MessageTitle}}

Verification:
- 3 mail-related files changed in Gitea v1.27.0→v1.27.1
- All 110 templates (10 themes × 11 types) render successfully
- No breaking changes — data structure unchanged, only access path

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-02 11:18:22 +08:00

200 lines
8.1 KiB
Cheetah

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="x-apple-disable-message-reformatting" />
<title>
{{.Subject}}
</title>
<style type="text/css">
/* Base */
body,.ExternalClass,.ReadMsgBody { background-color:#f5ede0 }
.email-wrap { max-width:600px;margin:40px auto;font-family:Georgia,'Times New Roman',serif }
/* Header */
.email-logo { display:block;margin:0 auto 10px;border:0;outline:none }
.email-brand { font-size:20px;font-weight:700;color:#fff;letter-spacing:1px;text-shadow:0 1px 2px rgba(0,0,0,0.1) }
.email-header { padding:0;background:linear-gradient(180deg,#c67b5c,#d4956e,#e8c4a8);height:100px;text-align:center;vertical-align:bottom }
/* Card */
.email-card { padding:28px 32px 24px;background:#fffdf9;color:#5c4030 }
.email-heading { margin:0;font-size:22px;line-height:1.4;color:#3d2b1f;font-weight:700 }
.email-text { margin:0 0 8px;font-size:15px;line-height:1.8;color:#6b5040 }
.email-subtext { margin:0 0 24px;font-size:14px;line-height:1.8;color:#8c7a6e;font-style:italic }
/* Divider */
.email-divider { height:1px;background:#d4c4a8;margin:0 }
/* Button */
.email-btn-row { padding:0 32px 28px;text-align:center;background:#fffdf9 }
.email-btn { display:inline-block;padding:14px 38px;font-size:15px;font-weight:600;color:#fff!important;text-decoration:none;background:#c67b5c;border-radius:24px;letter-spacing:0.3px }
.email-btn-table { margin:0 0 28px }
/* Fallback link */
.email-link-box { border:1px solid #d4c4a8;background:#f5ede0;border-radius:8px }
.email-link-label { margin:0 0 6px;font-size:12px;color:#8c7a6e;font-style:italic }
.email-link-url { margin:0;font-size:12px;font-family:monospace;color:#5c4030;background:#fffdf9;padding:10px 12px;border:1px solid #d4c4a8;border-radius:6px;word-break:break-all }
/* Footer */
.email-footer { padding:20px 32px;text-align:center;border-top:1px solid #d4c4a8;background:#f5ede0 }
.email-footer-text { margin:0;font-size:12px;color:#8c7a6e }
.email-footer-link { color:#c67b5c;text-decoration:none;font-weight:600 }
/* Typography utilities */
.card-body h1,.card-body h2,.card-body h3,.card-body h4,.card-body h5,.card-body h6 { color:#3d2b1f!important }
.card-body a,.card-body a:link,.card-body a:visited { color:#c67b5c!important;text-decoration:underline!important }
.card-body a:hover,.card-body a:active { color:#a06040!important }
.card-body li { color:#6b5040!important }
/* Responsive */
@media only screen and (max-width:480px) {
.email-card { padding:20px 16px!important }
.email-btn-row { padding:16px!important }
.email-heading { font-size:18px!important }
}
</style>
</head>
<body style="margin:0;padding:0;background:#f5ede0;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;">
<center style="width:100%;table-layout:fixed;">
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="email-wrap">
<!-- Floating Title -->
<tr>
<td class="email-header">
<img src="{{AppUrl}}assets/img/favicon.png" alt="logo" width="28" height="28" class="email-logo" />
<span class="email-brand">{{AppName}}</span>
<div style="width:40px;height:3px;background:#fff;margin:8px auto 0;border-radius:2px;opacity:0.6;"></div>
</td>
</tr>
<!-- Card -->
<tr>
<td class="email-card card-body">
<p class="email-heading"></p>
<p class="email-text">
{{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=\047%[1]s\047>%[2]s</a>" $oldCommitUrl $oldShortSha}}
{{$newCommitUrl := printf "%s/commit/%s" .Comment.Issue.PullRequest.BaseRepo.HTMLURL .Comment.NewCommit}}
{{$newShortSha := ShortSha .Comment.NewCommit}}
{{$newCommitLink := HTMLFormat "<a href=\047%[1]s\047>%[2]s</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" .Doer.Name .Issue.Index}}
{{else if eq .ActionName "reopen"}}
{{.locale.Tr "mail.issue.action.reopen" .Doer.Name .Issue.Index}}
{{else if eq .ActionName "merge"}}
{{.locale.Tr "mail.issue.action.merge" .Doer.Name .Issue.Index .Issue.PullRequest.BaseBranch}}
{{else if eq .ActionName "approve"}}
{{.locale.Tr "mail.issue.action.approve" .Doer.Name}}
{{else if eq .ActionName "reject"}}
{{.locale.Tr "mail.issue.action.reject" .Doer.Name}}
{{else if eq .ActionName "review"}}
{{.locale.Tr "mail.issue.action.review" .Doer.Name}}
{{else if eq .ActionName "review_dismissed"}}
{{.locale.Tr "mail.issue.action.review_dismissed" .Doer.Name .Comment.Review.Reviewer.Name}}
{{else if eq .ActionName "ready_for_review"}}
{{.locale.Tr "mail.issue.action.ready_for_review" .Doer.Name}}
{{end}}
{{- if eq .Body ""}}
{{if eq .ActionName "new"}}
{{.locale.Tr "mail.issue.action.new" .Doer.Name .Issue.Index}}
{{end}}
{{else}}
<span>{{.Body}}</span>
{{end -}}
{{if .CanReply}}
&nbsp;{{.locale.Tr "mail.reply"}}
{{end}}
</p>
{{- range .ReviewComments}}
<hr>
<p>{{$.locale.Tr "mail.issue.in_tree_path" .TreePath}}</p>
<pre>{{.Patch}}</pre>
<div>{{.RenderedContent}}</div>
{{end -}}
{{if eq .ActionName "push"}}
<ul>
{{range .Comment.Commits}}
<li>
<a href="{{$.Comment.Issue.PullRequest.BaseRepo.HTMLURL}}/commit/{{.UserCommit.GitCommit.ID}}">{{ShortSha .UserCommit.GitCommit.ID.String}}</a> - {{.UserCommit.GitCommit.MessageTitle}}
</li>
{{end}}
</ul>
{{end}}
</p>
<p class="email-subtext"></p>
</td>
</tr>
<!-- Divider -->
<tr>
<td class="email-divider"></td>
</tr>
<!-- Button & Link -->
<tr>
<td class="email-btn-row">
<table border="0" cellpadding="0" cellspacing="0" width="100%" class="email-btn-table">
<tr>
<td align="center">
<a href="{{.Link}}" class="email-btn">{{.locale.Tr "mail.view_it_on" AppName}}</a>
</td>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="email-link-box">
<tr>
<td style="padding:14px 16px;border-radius:8px;">
<p class="email-link-label">{{.locale.Tr "mail.link_not_working_do_paste"}}</p>
<p class="email-link-url">{{.Link}}</p>
</td>
</tr>
</table>
</td>
</tr>
<!-- Footer -->
<tr>
<td class="email-footer">
<p class="email-footer-text">
&copy;
<a href="{{AppUrl}}" class="email-footer-link">{{AppName}}</a>
</p>
</td>
</tr>
</table>
</center>
</body>
</html>