This commit is contained in:
tamakyi
2026-10-19 02:25:19 +08:00
parent 4592b6ef24
commit 12a37e726f
14 changed files with 315 additions and 5 deletions
+59
View File
@@ -0,0 +1,59 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta name="format-detection" content="email=no"/>
<meta name="format-detection" content="date=no"/>
</head>
<body style="margin: 0; padding: 0;" bgcolor="#FFFFFF">
<table width="100%" height="100%" style="min-width: 348px;" border="0" cellspacing="0" cellpadding="0" lang="zh-CN">
<tbody>
<tr height="32" style="height: 32px;">
<td></td>
</tr>
<tr align="center">
<td>
<table border="0" cellspacing="0" cellpadding="0"
style="padding-bottom: 20px;max-width: 516px;min-width: 220px;">
<tbody>
<tr>
<td width="8" style="width: 8px;"></td>
<td>
<div style="border-style: solid; border-width: thin; border-color:#dadce0; border-radius: 8px; padding: 40px 20px;"
align="center">
<div style="font-family: 'Google Sans',Roboto,RobotoDraft,Helvetica,Arial,sans-serif;border-bottom: thin solid #dadce0; color: rgba(0,0,0,0.87); line-height: 32px; padding-bottom: 24px;text-align: center; word-break: break-word;">
<div style="font-size: 22px;">
{{.heading}}
</div>
</div>
<div style="font-family: Roboto-Regular,Helvetica,Arial,sans-serif; font-size: 14px; color: rgba(0,0,0,0.87); line-height: 22px; padding-top: 20px; text-align: left;">
<div>{{.greeting}}</div>
<div style="padding: 12px 14px; border-radius: 6px; background-color: #fff8e1; border: 1px solid #ffe082; margin: 14px 0;">
<div>{{.body}}</div>
<div style="margin-top: 6px; color: rgba(0,0,0,0.6); font-size: 13px;">{{.note}}</div>
</div>
<div style="margin-top: 6px;">
<a href="{{.rulesURL}}" target="_blank" rel="noopener"
style="color: #1a73e8; text-decoration: none;">{{.rulesText}}</a>
</div>
<div style="margin-top: 14px; color: rgba(0,0,0,0.6); font-size: 13px;">
{{.appeal}}
</div>
</div>
</div>
<div style="text-align: center; font-size: 12px; color: rgba(0,0,0,0.4); padding-top: 16px;">
&copy; {{.year}} TamaBox
</div>
</td>
<td width="8" style="width: 8px;"></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</body>
</html>
+16
View File
@@ -406,4 +406,20 @@ func TestRenderUserQuestionList(t *testing.T) {
if err := renderWithData(t, "user/question-list", base); err != nil {
t.Fatalf("render user/question-list (keyword) failed: %v", err)
}
// 处置期条幅:必须显示「人话」级别名而不是裸代码(裸 L2 对箱主没有意义)。
base["Keyword"] = ""
base["RestrictionLevel"] = "L2"
base["RestrictionLevelName"] = i18n.T("zh-CN", "restriction.level.L2")
base["RestrictionExpiresAt"] = "2026-11-01"
out, err := renderToString(t, "user/question-list", base)
if err != nil {
t.Fatalf("render user/question-list (restriction banner) failed: %v", err)
}
if !strings.Contains(out, "收窄公开") {
t.Fatal("restriction banner should show level name (收窄公开), got none")
}
if !strings.Contains(out, "2026-11-01") {
t.Fatal("restriction banner should show expiry date")
}
}
+1 -1
View File
@@ -177,7 +177,7 @@
{{ if .RestrictionLevel }}
<!-- 处置期常驻提示:L1 停分发 / L2 新回答不公开 / L3 禁止发布 -->
<div class="uk-alert-warning" uk-alert>
<div>{{t .LangCode "qlist.restrictionBanner" .RestrictionLevel .RestrictionExpiresAt}} <span class="uk-text-meta">·</span> <a href="/rules">{{t .LangCode "qlist.restrictionRulesLink"}}</a></div>
<div>{{t .LangCode "qlist.restrictionBanner" (or .RestrictionLevelName .RestrictionLevel) .RestrictionExpiresAt}} <span class="uk-text-meta">·</span> <a href="/rules">{{t .LangCode "qlist.restrictionRulesLink"}}</a></div>
</div>
{{ end }}