fix: 修复关注/粉丝列表隐私检查假阳性导致本人也无法访问

- follow_repo.go: GetFollowListPublic 改用显式 WHERE uid=? 避免 GORM 主键解析潜在问题
- follow_service.go: GetFollowListPublic 失败时默认公开并记录日志,而非返回错误
- follow_controller.go: 错误兜底时 Accessible 默认 true,避免误锁用户
This commit is contained in:
2026-06-01 20:22:50 +08:00
parent bab8e47d63
commit a0df66587b
3 changed files with 13 additions and 7 deletions

View File

@ -106,7 +106,10 @@ func (r *FollowRepo) IncrFollowingCount(userID uint, delta int) error {
// GetFollowListPublic 查询用户关注列表公开性
func (r *FollowRepo) GetFollowListPublic(userID uint) (bool, error) {
var user model.User
err := r.db.Select("follow_list_public").First(&user, userID).Error
return user.FollowListPublic, err
var listPublic bool
err := r.db.Model(&model.User{}).
Select("follow_list_public").
Where("uid = ?", userID).
Scan(&listPublic).Error
return listPublic, err
}