mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-06-29 06:20:32 +08:00
添加好友时,通知更新
This commit is contained in:
parent
d346fcb4d6
commit
8c442c2e24
@ -700,15 +700,11 @@ func (s *friendServer) AddOnewayFriend(ctx context.Context, req *relation.ApplyT
|
||||
if err := s.db.BecomeOnewayFriend(ctx, req.FromUserID, req.ToUserID, becomeFriendByOneway, req.Remark); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// 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)
|
||||
|
||||
// Silently notify only A (FromUserID) to trigger an incremental friend-list sync
|
||||
// so the remark is reflected in the conversation list.
|
||||
// B (ToUserID) receives no notification of any kind.
|
||||
s.notificationSender.FriendAddedOnewayNotification(ctx, req.FromUserID, req.ToUserID)
|
||||
return &relation.ApplyToAddFriendResp{}, nil
|
||||
}
|
||||
|
||||
|
||||
@ -282,6 +282,19 @@ func (f *FriendNotificationSender) FriendsInfoUpdateNotification(ctx context.Con
|
||||
f.Notification(ctx, toUserID, toUserID, constant.FriendsInfoUpdateNotification, &tips)
|
||||
}
|
||||
|
||||
// FriendAddedOnewayNotification silently notifies ownerUserID that friendUserID has been added
|
||||
// to their friend list (one-way, no consent from friendUserID required).
|
||||
// isSendMsg=false ensures no visible message appears in either user's conversation list.
|
||||
func (f *FriendNotificationSender) FriendAddedOnewayNotification(ctx context.Context, ownerUserID, friendUserID string) {
|
||||
tips := sdkws.FriendsInfoUpdateTips{
|
||||
FromToUserID: &sdkws.FromToUserID{ToUserID: ownerUserID},
|
||||
FriendIDs: []string{friendUserID},
|
||||
}
|
||||
f.setSortVersion(ctx, &tips.FriendVersion, &tips.FriendVersionID,
|
||||
database.FriendVersionName, ownerUserID, &tips.FriendSortVersion)
|
||||
f.Notification(ctx, ownerUserID, ownerUserID, constant.FriendsInfoUpdateNotification, &tips)
|
||||
}
|
||||
|
||||
func (f *FriendNotificationSender) BlackAddedNotification(ctx context.Context, req *relation.AddBlackReq) {
|
||||
tips := sdkws.BlackAddedTips{FromToUserID: &sdkws.FromToUserID{}}
|
||||
tips.FromToUserID.FromUserID = req.OwnerUserID
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user