mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-26 19:46:57 +08:00
friend
This commit is contained in:
parent
fc1425b797
commit
95c1259d65
@ -54,11 +54,12 @@ func FriendsDB2Pb(ctx context.Context, friendsDB []*relation.FriendModel, getUse
|
|||||||
}
|
}
|
||||||
|
|
||||||
func FriendRequestDB2Pb(ctx context.Context, friendRequests []*relation.FriendRequestModel, getUsers func(ctx context.Context, userIDs []string) (map[string]*sdkws.UserInfo, error)) (PBFriendRequests []*sdkws.FriendRequest, err error) {
|
func FriendRequestDB2Pb(ctx context.Context, friendRequests []*relation.FriendRequestModel, getUsers func(ctx context.Context, userIDs []string) (map[string]*sdkws.UserInfo, error)) (PBFriendRequests []*sdkws.FriendRequest, err error) {
|
||||||
var userID []string
|
userIDMap := make(map[string]struct{})
|
||||||
for _, friendRequest := range friendRequests {
|
for _, friendRequest := range friendRequests {
|
||||||
userID = append(userID, friendRequest.FromUserID)
|
userIDMap[friendRequest.ToUserID] = struct{}{}
|
||||||
|
userIDMap[friendRequest.FromUserID] = struct{}{}
|
||||||
}
|
}
|
||||||
users, err := getUsers(ctx, userID)
|
users, err := getUsers(ctx, utils.Keys(userIDMap))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user