feat: 用户可见自己帖子的审核状态

- 发帖后若未直接过审,弹窗明确「审核中,通过后才出现在社区」,
  不再让用户以为发失败/是 bug
- 后端 ListUserPosts:看自己主页时返回待审核/未通过的帖子(带状态),
  看别人仍只返回已发布
- 个人主页帖子加「审核中/未通过」状态标 + 说明
- 我的页加「我的帖子」入口,进自己主页看审核状态

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Blizzard
2026-07-31 08:49:20 +08:00
parent b01effaf5e
commit 603bd5773e
7 changed files with 52 additions and 3 deletions
+8 -1
View File
@@ -188,7 +188,14 @@ func (s *Service) UpdateDecoration(userID string, bio, bgFileID, theme *string,
// ListUserPosts 某人发布的帖子
func (s *Service) ListUserPosts(viewerID, userID string, offset, limit int) ([]model.Post, int64, error) {
q := s.db.Model(&model.Post{}).Where("user_id = ? AND status = ?", userID, "published")
q := s.db.Model(&model.Post{}).Where("user_id = ?", userID)
if viewerID == userID {
// 看自己:待审核/未通过的也要能看到(带状态展示),只藏软删除的
q = q.Where("status <> ?", model.PostDeleted)
} else {
// 看别人:只放已过审的
q = q.Where("status = ?", model.PostPublished)
}
var total int64
if err := q.Count(&total).Error; err != nil {
return nil, 0, err