feat: SSR 帖/评举报与 Admin 处理

EOF

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-29 17:47:09 +08:00
parent 802f86605c
commit 83994e2707
16 changed files with 465 additions and 13 deletions

View File

@@ -36,6 +36,7 @@ type PostPageData struct {
Comments []CommentView
CommentsLocked bool
CanEdit bool
CanReportPost bool
}
// CommentView 评论
@@ -53,6 +54,7 @@ type CommentView struct {
LikeCount int
Liked bool
IsPrivate bool
CanReport bool
}
// PostView GET /post/:id
@@ -88,6 +90,7 @@ func (d Deps) PostView(c *gin.Context) {
CreatedLabel: formatTime(cm.CreatedAt),
Content: cm.Content, ContentHidden: cm.ContentHidden,
LikeCount: cm.LikeCount, Liked: cm.Liked, IsPrivate: cm.IsPrivate,
CanReport: ctx.IsSigned() && (cm.UserID == 0 || cm.UserID != ctx.UserID()),
}
if cm.ReplyTarget != nil {
view.ReplyToID = cm.ReplyTarget.ID
@@ -130,6 +133,7 @@ func (d Deps) PostView(c *gin.Context) {
BodyHTML: body, CommentCount: len(cv), Comments: cv,
CommentsLocked: post.CommentsLocked,
CanEdit: d.Post.CanUserEdit(post, ctx.UserID(), ctx.IsAdmin()),
CanReportPost: ctx.IsSigned() && post.UserID != ctx.UserID(),
})
}