feat(comments): 支持编辑与管理可见历史,采纳展示改用楼层号

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-16 08:05:41 +08:00
parent d032668c66
commit 1b2b87c976
14 changed files with 716 additions and 42 deletions

View File

@@ -330,6 +330,7 @@ func EnsureDeadlineOnPublish(typeMeta, postType string, publishedAt time.Time) (
type QuestionState struct {
Solved bool `json:"solved"`
AcceptedCommentID uint `json:"accepted_comment_id"`
AcceptedFloor int `json:"accepted_floor"`
CanAccept bool `json:"can_accept"`
CanSolve bool `json:"can_solve"`
CanReopen bool `json:"can_reopen"`
@@ -366,6 +367,7 @@ type PollState struct {
type BountyState struct {
Points int `json:"points"`
AcceptedCommentID uint `json:"accepted_comment_id"`
AcceptedFloor int `json:"accepted_floor"`
Escrowed bool `json:"escrowed"`
Refunded bool `json:"refunded"`
Expired bool `json:"expired"`
@@ -425,6 +427,7 @@ func (s *PostService) buildQuestionState(post *model.Post, canManage bool) *Ques
return &QuestionState{
Solved: m.Solved,
AcceptedCommentID: m.AcceptedCommentID,
AcceptedFloor: FloorNumber(s.db, post.ID, m.AcceptedCommentID),
CanAccept: canManage && !m.Solved,
CanSolve: canManage && !m.Solved,
CanReopen: canManage && m.Solved,
@@ -530,6 +533,7 @@ func (s *PostService) buildBountyState(post *model.Post, canManage bool) *Bounty
return &BountyState{
Points: m.Points,
AcceptedCommentID: m.AcceptedCommentID,
AcceptedFloor: FloorNumber(s.db, post.ID, m.AcceptedCommentID),
Escrowed: m.Escrowed,
Refunded: m.Refunded,
Expired: m.Expired,