From 899b6d7f32af8ca4335cb91b9bfef96dbcca15f4 Mon Sep 17 00:00:00 2001 From: tamakyi Date: Mon, 19 Oct 2026 03:01:17 +0800 Subject: [PATCH] fix v16 --- .workbuddy/memory/2026-10-19.md | 23 +++++++++++++++++++++++ internal/mail/mail.go | 5 ++++- templates/mail/restriction-notice.html | 21 ++++++++++++++++----- 3 files changed, 43 insertions(+), 6 deletions(-) diff --git a/.workbuddy/memory/2026-10-19.md b/.workbuddy/memory/2026-10-19.md index de89a78..2386959 100644 --- a/.workbuddy/memory/2026-10-19.md +++ b/.workbuddy/memory/2026-10-19.md @@ -78,3 +78,26 @@ hide-public、ban/restore、典型处置流程、排错表、明确不做的事 实测(本地 SMTP sink,2 封):处置信含级别名/到期/申诉段;解除信含「已解除」+ 私密内容提示、 **无申诉段**;两封都不含 `--reason`。`--no-notify` 两处都不发信;无生效处置时不发信。 `go build ./...`、db/i18n/templates 测试、checktpl 全绿。 + +## 上线前最终验收(部署后实测) + +- 公开页:`/` `/rules` `/restricted` `/deactivated` 全部 200;`/rules` 四语言标题正确。 +- 箱主面板(admin6,L2):条幅显示「收窄公开」+ 规则链接;严格度面板锁定提示 1 处、下拉 disabled。 +- **L2 写入路径实测**(关键,因为改成了 `AnswerByIDPrivate` 单条 UPDATE): + 对未回答题 q95 作答 → 302 回题目页 → flash「已保存为私密:当前处于平台处置期,回答不会公开」→ 匿名访问 302。 +- 公开列表 API `/api/v1/user/{domain}/questions` 正常返回 `{code,data:{data,next_cursor,has_more}}`(新增的 L4/密码校验没有打断正常路径)。 +- 整箱分享卡:受处置箱主 302(拦截生效);未处置箱主 500,原因是**测试站未配置字体**(`分享图生成失败:字体文件未配置或无法加载`),与本次改动无关。 + 这一点反而证明拦截位置在生成之前。 +- 未能自测:CLI 发信(restrict/unrestrict 通知)需要在服务器上跑命令,只能由用户执行。 + +注意:admin6 现有测试题 73/88/89/90/94/95;其中 95 已被我回答并存为私密(内容带 `restrict self-check`)。 +admin6 的 L2 于 2026-10-19 21:29 自动到期。 + +## 邮件模板统一(用户反馈:页脚与其它邮件不一致) + +- 原因:`restriction-notice.html` 是我新写的,页脚用了自造的 `© 2026 TamaBox`,与项目其它 11 封邮件的 + 「此邮件由系统自动发送,请勿直接回复。
{{ .year }} 狼的提问箱」不一致。 +- 处理:整封模板按 `question-reported.html` 的结构重写(24px 标题 + `{{.time}}` 副行、同样的卡片/页脚/外间距), + `time` 由 `mail.SendRestrictionNoticeMail` 统一注入(调用方不用各自拼时间)。 +- 实测(本地 SMTP sink):页脚文本与 question-reported 完全一致,`© ... TamaBox` 已消失,头部时间行存在。 +- 注意:站点名在所有邮件模板里都是硬编码「狼的提问箱」,不是配置项;改站名要一起改 12 个模板。 diff --git a/internal/mail/mail.go b/internal/mail/mail.go index 6455d4f..def4199 100644 --- a/internal/mail/mail.go +++ b/internal/mail/mail.go @@ -165,7 +165,10 @@ type RestrictionNotice struct { // SendRestrictionNoticeMail 告知箱主「你的提问箱已被限制」。 func SendRestrictionNoticeMail(n RestrictionNotice) error { params := map[string]string{ - "heading": n.Heading, + "heading": n.Heading, + // time 由邮件包统一注入:调用方(CLI / 未来可能的自动流程)不必各自拼时间, + // 也保证与其他通知邮件(question-reported / abuse-alert)的头部格式一致。 + "time": time.Now().Format("2006-01-02 15:04:05"), "greeting": n.Greeting, "body": n.Body, "note": n.Note, diff --git a/templates/mail/restriction-notice.html b/templates/mail/restriction-notice.html index 6fa49af..2dec5ed 100644 --- a/templates/mail/restriction-notice.html +++ b/templates/mail/restriction-notice.html @@ -21,9 +21,12 @@
-
+
{{.heading}}
+
+ {{.time}} +
{{.greeting}}
@@ -35,18 +38,23 @@
{{.rulesText}} + style="color: #1e87f0; text-decoration: none;">{{.rulesText}}
{{if .appeal}} -
+
{{.appeal}}
{{end}}
-
- © {{.year}} TamaBox +
+
+
+ 此邮件由系统自动发送,请勿直接回复。
+ {{ .year }} 狼的提问箱 +
+
@@ -55,6 +63,9 @@ + + +