refactor: 重构 Space 页面为统一多 Tab 布局 + 移除独立关注/粉丝子页面

- 后端:SpaceController 支持 5 个 Tab(文章/关注/粉丝/收藏/设置),统一处理本人与访客视图
- 后端:注入 FavoriteService 支持收藏夹 Tab,新增用户统计数据查询
- 后端:新增 PUT /api/space/privacy 隐私设置 API 端点
- 后端:移除 FollowPageController 及 /space/:uid/followers|following 路由
- 前端:完全重写 space/index.html,顶部信息栏 + Tab 导航 + 左侧栏 + 主内容区
- 前端:重写 space.css 适配新布局(Profile Header/Tab Bar/文章/收藏/设置)
- 清理:删除独立的 follow HTML 模板和 CSS 文件
- 模型:User 表新增 follower_list_public 隐私字段
This commit is contained in:
2026-06-01 21:48:01 +08:00
parent 797e9c15f4
commit d9eff2df08
15 changed files with 1450 additions and 632 deletions

View File

@ -80,17 +80,17 @@ func buildDeps(db *gorm.DB, cfg *config.Config, siteSettings *config.SiteSetting
followService := service.NewFollowService(db, followRepo)
followService.SetNotifier(notificationService) // 关注通知
followCtrl := controller.NewFollowController(followService)
followPageCtrl := controller.NewFollowPageController(followService)
// 收藏夹系统(需在 SpaceController 之前初始化)
favoriteRepo := repository.NewFavoriteRepo(db)
favoriteService := service.NewFavoriteService(db, favoriteRepo)
favoriteCtrl := controller.NewFavoriteController(favoriteService)
// 用户空间
spaceService := service.NewSpaceService(userRepo, postRepo)
spaceCtrl := controller.NewSpaceController(spaceService)
spaceCtrl.WithFollowService(followService)
// 收藏夹系统
favoriteRepo := repository.NewFavoriteRepo(db)
favoriteService := service.NewFavoriteService(db, favoriteRepo)
favoriteCtrl := controller.NewFavoriteController(favoriteService)
spaceCtrl.WithFavoriteService(favoriteService)
// Studio 趋势图
trendsService := service.NewTrendsService(energyRepo, commentRepo, reactionRepo, favoriteRepo)
@ -115,7 +115,6 @@ func buildDeps(db *gorm.DB, cfg *config.Config, siteSettings *config.SiteSetting
adminCommentCtrl: adminCommentCtrl,
reactionCtrl: reactionCtrl,
followCtrl: followCtrl,
followPageCtrl: followPageCtrl,
favoriteCtrl: favoriteCtrl,
favoriteService: favoriteService,
trendsService: trendsService,