mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-06 01:55:58 +08:00
fix bug: friend, args error (#534)
* fix bug: args error * fix bug: args error * fix bug: add friend need update both request * fix bug: add friend need update both request
This commit is contained in:
@@ -27,6 +27,9 @@ func BlackDB2Pb(
|
||||
blackDBs []*relation.BlackModel,
|
||||
f func(ctx context.Context, userIDs []string) (map[string]*sdkws.UserInfo, error),
|
||||
) (blackPbs []*sdk.BlackInfo, err error) {
|
||||
if len(blackDBs) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
var userIDs []string
|
||||
for _, blackDB := range blackDBs {
|
||||
userIDs = append(userIDs, blackDB.BlockUserID)
|
||||
|
||||
@@ -54,6 +54,9 @@ func FriendsDB2Pb(
|
||||
friendsDB []*relation.FriendModel,
|
||||
getUsers func(ctx context.Context, userIDs []string) (map[string]*sdkws.UserInfo, error),
|
||||
) (friendsPb []*sdkws.FriendInfo, err error) {
|
||||
if len(friendsDB) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
var userID []string
|
||||
for _, friendDB := range friendsDB {
|
||||
userID = append(userID, friendDB.FriendUserID)
|
||||
@@ -80,6 +83,9 @@ func FriendRequestDB2Pb(
|
||||
friendRequests []*relation.FriendRequestModel,
|
||||
getUsers func(ctx context.Context, userIDs []string) (map[string]*sdkws.UserInfo, error),
|
||||
) ([]*sdkws.FriendRequest, error) {
|
||||
if len(friendRequests) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
userIDMap := make(map[string]struct{})
|
||||
for _, friendRequest := range friendRequests {
|
||||
userIDMap[friendRequest.ToUserID] = struct{}{}
|
||||
|
||||
Reference in New Issue
Block a user