feat: 实时消息与管理端运营能力
新增群聊/私信与公共 WebSocket 总线,站长用户内容档案,并将通知与待审角标改为推送驱动;同步精简管理仪表盘并修复主题换肤 DOM 冲突。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -23,17 +23,22 @@ func (h *Handlers) PostComments(c *gin.Context) {
|
||||
|
||||
// 待审/被拒帖子的评论不对公众开放
|
||||
var viewerID uint
|
||||
var actor *service.Actor
|
||||
var loadActor func() *service.Actor
|
||||
if claims := middleware.CurrentUser(c); claims != nil {
|
||||
viewerID = claims.ID
|
||||
loadActor = h.actorLoader(claims.ID)
|
||||
if a, err := h.Auth.LoadActor(claims.ID); err == nil {
|
||||
actor = a
|
||||
}
|
||||
}
|
||||
if err := h.Post.EnsurePostVisible(uint(id), viewerID, loadActor); err != nil {
|
||||
c.JSON(http.StatusNotFound, gin.H{"error": "帖子不存在"})
|
||||
return
|
||||
}
|
||||
boardID, _ := h.Post.GetBoardID(uint(id))
|
||||
|
||||
comments, floors, totalComments, err := h.Comment.ListFloorPaged(uint(id), page, size)
|
||||
comments, floors, totalComments, err := h.Comment.ListFloorPaged(uint(id), boardID, viewerID, actor, page, size)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
@@ -86,6 +91,13 @@ func (h *Handlers) CreateComment(c *gin.Context) {
|
||||
// 子回复:通知父评论作者(Notification.Create 内部排除自我通知)
|
||||
h.Notification.Create(parent.UserID, claims.ID, model.NotificationTypeReply, uint(id), comment.ID, req.Content)
|
||||
}
|
||||
if boardID, e := h.Post.GetBoardID(uint(id)); e == nil {
|
||||
h.broadcastFeedChanged("comment", uint(id), boardID, claims.ID)
|
||||
}
|
||||
} else if comment.Status == model.ContentStatusPending {
|
||||
if boardID, e := h.Post.GetBoardID(uint(id)); e == nil {
|
||||
h.notifyPendingReview(boardID, claims.ID, uint(id), comment.ID, "有新评论待审核")
|
||||
}
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"comment": comment})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user