feat: SSR 私信与通知(/messages)

会话列表、读写、未读角标与全部已读;系统会话只读;用户主页可发起私信。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-29 05:59:54 +08:00
parent 126e3bae98
commit 40ec20b3df
14 changed files with 455 additions and 11 deletions

View File

@@ -47,6 +47,7 @@ type PageChrome struct {
CSRF string
Flash string
Error string
UnreadCount int64 // 登录用户未读私信/通知总数;未登录为 0
}
func (d Deps) ctx(c *gin.Context) *webctx.Context {
@@ -73,6 +74,10 @@ func (d Deps) chrome(ctx *webctx.Context, title, desc, inner string) PageChrome
for _, b := range boards {
bv = append(bv, BoardView{ID: b.ID, Name: b.Name})
}
var unread int64
if ctx.IsSigned() && d.Message != nil {
unread, _ = d.Message.UnreadCount(ctx.UserID())
}
return PageChrome{
Title: title,
Description: desc,
@@ -86,6 +91,7 @@ func (d Deps) chrome(ctx *webctx.Context, title, desc, inner string) PageChrome
Inner: inner,
CSRF: ctx.EnsureCSRF(),
Flash: ctx.TakeFlash(),
UnreadCount: unread,
}
}