feat: apply configured default user avatars
This commit is contained in:
+10
-2
@@ -3252,10 +3252,12 @@ func serveIMMe(wrt http.ResponseWriter, req *http.Request) {
|
||||
writeIMRelationError(wrt, req, err)
|
||||
return
|
||||
}
|
||||
profilePayload := userProfilePayload10(profile)
|
||||
applyDefaultUserAvatar(profilePayload, principal.Uid.UserId(), profile.Gender)
|
||||
writeIMSuccess(wrt, req, map[string]any{
|
||||
"user_id": principal.Uid.UserId(),
|
||||
"username": account["username"],
|
||||
"profile": userProfilePayload10(profile),
|
||||
"profile": profilePayload,
|
||||
"profile_version": profile.Version,
|
||||
"realname": map[string]any{"status": "unknown"},
|
||||
"youth_mode": map[string]any{"enabled": false},
|
||||
@@ -10104,6 +10106,7 @@ func currentUserProfilePayload(tenantID types.TenantID, uid types.Uid, profile *
|
||||
return nil, err
|
||||
}
|
||||
data := userProfilePayload10(profile)
|
||||
applyDefaultUserAvatar(data, uid.UserId(), profile.Gender)
|
||||
data["phone_mask"] = account["phone_mask"]
|
||||
data["username"] = account["username"]
|
||||
return data, nil
|
||||
@@ -10721,10 +10724,14 @@ func userSummaryPayload(user *types.User, remark string) map[string]any {
|
||||
userID = user.Id
|
||||
}
|
||||
data := map[string]any{"user_id": userID}
|
||||
gender := ""
|
||||
if public, ok := user.Public.(map[string]any); ok {
|
||||
copyUserPublicSummary(data, public)
|
||||
gender = stringFromAny(public["gender"])
|
||||
} else if public, ok := user.Public.(types.KVMap); ok {
|
||||
copyUserPublicSummary(data, map[string]any(public))
|
||||
publicMap := map[string]any(public)
|
||||
copyUserPublicSummary(data, publicMap)
|
||||
gender = stringFromAny(publicMap["gender"])
|
||||
}
|
||||
if remark != "" {
|
||||
data["display_name"] = remark
|
||||
@@ -10732,6 +10739,7 @@ func userSummaryPayload(user *types.User, remark string) map[string]any {
|
||||
if _, ok := data["display_name"]; !ok {
|
||||
data["display_name"] = userID
|
||||
}
|
||||
applyDefaultUserAvatar(data, userID, gender)
|
||||
return data
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user