fix im heartbeat and friend display name
This commit is contained in:
+18
-7
@@ -9206,12 +9206,23 @@ func relationshipContextPayload(ctx *types.RelationshipContext) map[string]any {
|
||||
if ctx.RequestID != "" {
|
||||
data["request_id"] = ctx.RequestID
|
||||
}
|
||||
if ctx.Remark != "" {
|
||||
data["remark"] = ctx.Remark
|
||||
}
|
||||
if ctx.Peer != nil {
|
||||
data["peer"] = map[string]any{
|
||||
"user_id": ctx.PeerID.UserId(),
|
||||
"public": ctx.Peer.Public,
|
||||
"trusted": ctx.Peer.Trusted,
|
||||
peer := userSummaryPayload(ctx.Peer, ctx.Remark)
|
||||
peer["public"] = ctx.Peer.Public
|
||||
peer["trusted"] = ctx.Peer.Trusted
|
||||
data["peer"] = peer
|
||||
if displayName, ok := peer["display_name"]; ok {
|
||||
data["display_name"] = displayName
|
||||
}
|
||||
if avatarFileID, ok := peer["avatar_file_id"]; ok {
|
||||
data["avatar_file_id"] = avatarFileID
|
||||
}
|
||||
}
|
||||
if _, ok := data["display_name"]; !ok {
|
||||
data["display_name"] = ctx.PeerID.UserId()
|
||||
}
|
||||
return data
|
||||
}
|
||||
@@ -9366,14 +9377,14 @@ func userSummaryPayload(user *types.User, remark string) map[string]any {
|
||||
userID = user.Id
|
||||
}
|
||||
data := map[string]any{"user_id": userID}
|
||||
if remark != "" {
|
||||
data["display_name"] = remark
|
||||
}
|
||||
if public, ok := user.Public.(map[string]any); ok {
|
||||
copyUserPublicSummary(data, public)
|
||||
} else if public, ok := user.Public.(types.KVMap); ok {
|
||||
copyUserPublicSummary(data, map[string]any(public))
|
||||
}
|
||||
if remark != "" {
|
||||
data["display_name"] = remark
|
||||
}
|
||||
if _, ok := data["display_name"]; !ok {
|
||||
data["display_name"] = userID
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user