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

@@ -442,5 +442,10 @@ func (s *ModerationService) PurgeComment(actor *Actor, id uint) error {
if !cm.DeletedAt.Valid {
return ErrContentNotDeleted
}
return s.db.Unscoped().Delete(&model.Comment{}, id).Error
return s.db.Transaction(func(tx *gorm.DB) error {
if err := tx.Where("comment_id = ?", id).Delete(&model.CommentEditHistory{}).Error; err != nil {
return err
}
return tx.Unscoped().Delete(&model.Comment{}, id).Error
})
}