fix: 修复发帖后链接404 + 通知卡片跳转错误
- post_repo.go: FindByIDWithAuthor/Restore 中 posts.uid 改为 posts.id(posts 表主键是 id,不存在 uid 列) - theme/loader.go: 新增 derefUint 模板函数,显式解引用 *uint 指针(Go 1.26 模板引擎传参给 printf 时不自动解引用) - messages/index.html: 通知卡片链接使用 derefUint 包裹 RelatedID 避免打印指针地址
This commit is contained in:
@ -40,7 +40,7 @@
|
||||
{{range $i, $m := .Messages}}
|
||||
{{$link := ""}}
|
||||
{{if or (eq $m.NotifyType "post_approved") (eq $m.NotifyType "post_rejected")}}
|
||||
{{$link = printf "/posts/%d" $m.RelatedID}}
|
||||
{{$link = printf "/posts/%d" (derefUint $m.RelatedID)}}
|
||||
{{else if or (eq $m.NotifyType "audit_approved") (eq $m.NotifyType "audit_rejected")}}
|
||||
{{$link = "/settings"}}
|
||||
{{end}}
|
||||
|
||||
Reference in New Issue
Block a user