mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-06-18 05:38:14 +08:00
first name
This commit is contained in:
parent
6e42d00794
commit
d346fcb4d6
@ -314,7 +314,11 @@ func (s *friendServer) GetFriendInfo(ctx context.Context, req *relation.GetFrien
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &relation.GetFriendInfoResp{FriendInfos: convert.FriendOnlyDB2PbOnly(friends)}, nil
|
||||
users, err := s.userClient.GetUsersInfoMap(ctx, req.FriendUserIDs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &relation.GetFriendInfoResp{FriendInfos: convert.FriendOnlyDB2PbOnly(friends, users)}, nil
|
||||
}
|
||||
|
||||
func (s *friendServer) GetDesignatedFriends(ctx context.Context, req *relation.GetDesignatedFriendsReq) (resp *relation.GetDesignatedFriendsResp, err error) {
|
||||
@ -698,13 +702,13 @@ func (s *friendServer) AddOnewayFriend(ctx context.Context, req *relation.ApplyT
|
||||
}
|
||||
// Notify only A (FromUserID) so incremental friend sync is triggered
|
||||
// without notifying B (ToUserID).
|
||||
tips := sdkws.FriendApplicationApprovedTips{
|
||||
FromToUserID: &sdkws.FromToUserID{
|
||||
FromUserID: req.FromUserID,
|
||||
ToUserID: req.ToUserID,
|
||||
},
|
||||
}
|
||||
s.notificationSender.Notification(ctx, req.FromUserID, req.FromUserID, constant.FriendApplicationApprovedNotification, &tips)
|
||||
//tips := sdkws.FriendApplicationApprovedTips{
|
||||
// FromToUserID: &sdkws.FromToUserID{
|
||||
// FromUserID: req.FromUserID,
|
||||
// ToUserID: req.ToUserID,
|
||||
// },
|
||||
//}
|
||||
//s.notificationSender.Notification(ctx, req.FromUserID, req.FromUserID, constant.FriendApplicationApprovedNotification, &tips)
|
||||
return &relation.ApplyToAddFriendResp{}, nil
|
||||
}
|
||||
|
||||
|
||||
@ -78,6 +78,8 @@ func FriendsDB2Pb(ctx context.Context, friendsDB []*model.Friend, getUsers func(
|
||||
friendPb.FriendUser.Nickname = users[friend.FriendUserID].Nickname
|
||||
friendPb.FriendUser.FaceURL = users[friend.FriendUserID].FaceURL
|
||||
friendPb.FriendUser.Ex = users[friend.FriendUserID].Ex
|
||||
friendPb.FriendUser.FirstName = users[friend.FriendUserID].FirstName
|
||||
friendPb.FriendUser.LastName = users[friend.FriendUserID].LastName
|
||||
friendPb.CreateTime = friend.CreateTime.Unix()
|
||||
friendPb.IsPinned = friend.IsPinned
|
||||
friendPb.IsMute = friend.IsMuted
|
||||
@ -88,9 +90,9 @@ func FriendsDB2Pb(ctx context.Context, friendsDB []*model.Friend, getUsers func(
|
||||
return friendsPb, nil
|
||||
}
|
||||
|
||||
func FriendOnlyDB2PbOnly(friendsDB []*model.Friend) []*relation.FriendInfoOnly {
|
||||
func FriendOnlyDB2PbOnly(friendsDB []*model.Friend, users map[string]*sdkws.UserInfo) []*relation.FriendInfoOnly {
|
||||
return datautil.Slice(friendsDB, func(f *model.Friend) *relation.FriendInfoOnly {
|
||||
return &relation.FriendInfoOnly{
|
||||
info := &relation.FriendInfoOnly{
|
||||
OwnerUserID: f.OwnerUserID,
|
||||
FriendUserID: f.FriendUserID,
|
||||
Remark: f.Remark,
|
||||
@ -103,6 +105,11 @@ func FriendOnlyDB2PbOnly(friendsDB []*model.Friend) []*relation.FriendInfoOnly {
|
||||
MuteDuration: f.MuteDuration,
|
||||
MuteEndTime: f.MuteEndTime,
|
||||
}
|
||||
if u, ok := users[f.FriendUserID]; ok {
|
||||
info.FirstName = u.FirstName
|
||||
info.LastName = u.LastName
|
||||
}
|
||||
return info
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
2
protocol
2
protocol
@ -1 +1 @@
|
||||
Subproject commit 7f613eb71f23a69730cfb3c3abd1515da0fb17cf
|
||||
Subproject commit 0db6a732426df40792921f861112e32785405e8d
|
||||
Loading…
x
Reference in New Issue
Block a user