fix(user): add VerificationStatusNone for users without verification
Some checks failed
Deploy / deploy (pull_request) Has been cancelled
Build Backend / build-docker (pull_request) Has been cancelled
Build Backend / build (pull_request) Has been cancelled

Add VerificationStatusNone constant and update converter to return
general identity with none status instead of empty strings when user
has not applied for verification.
This commit is contained in:
lafay
2026-04-26 19:42:10 +08:00
parent f99687c405
commit 5d12397e29
2 changed files with 5 additions and 2 deletions

View File

@@ -12,12 +12,14 @@ func getAvatarOrDefault(user *model.User) string {
return utils.GetAvatarOrDefault(user.Username, user.Nickname, user.Avatar)
}
// publicVerificationFields 仅在认证通过时返回身份和状态,避免泄漏审核中/已拒绝等隐私信息
// publicVerificationFields 返回认证信息
// - approved 时返回真实身份和状态
// - 其他状态统一返回 general + none不暴露具体审核状态
func publicVerificationFields(user *model.User) (model.UserIdentity, model.VerificationStatus) {
if user.VerificationStatus == model.VerificationStatusApproved {
return user.Identity, user.VerificationStatus
}
return "", ""
return model.UserIdentityGeneral, model.VerificationStatusNone
}
// ConvertUserToResponse 将User转换为UserResponse公开信息不包含敏感数据