手机可见性bugfix

pull/3727/head
hawklin2017 2 weeks ago
parent 1a361405cc
commit 47aa96989c

@ -15,21 +15,23 @@ import (
)
func (s *friendServer) NotificationUserInfoUpdate(ctx context.Context, req *relation.NotificationUserInfoUpdateReq) (*relation.NotificationUserInfoUpdateResp, error) {
userIDs, err := s.db.FindFriendUserIDs(ctx, req.UserID)
// 单向好友:仅通知「好友列表中包含 req.UserID」的用户owner -> req.UserID
// 而非 req.UserID 自己好友列表中的对端。
ownerUserIDs, err := s.db.FindFriendUserID(ctx, req.UserID)
if err != nil {
return nil, err
}
if len(userIDs) > 0 {
if len(ownerUserIDs) > 0 {
friendUserIDs := []string{req.UserID}
noCancelCtx := context.WithoutCancel(ctx)
err := s.queue.PushCtx(ctx, func() {
for _, userID := range userIDs {
if err := s.db.OwnerIncrVersion(noCancelCtx, userID, friendUserIDs, model.VersionStateUpdate); err != nil {
log.ZError(ctx, "OwnerIncrVersion", err, "userID", userID, "friendUserIDs", friendUserIDs)
for _, ownerUserID := range ownerUserIDs {
if err := s.db.OwnerIncrVersion(noCancelCtx, ownerUserID, friendUserIDs, model.VersionStateUpdate); err != nil {
log.ZError(ctx, "OwnerIncrVersion", err, "userID", ownerUserID, "friendUserIDs", friendUserIDs)
}
}
for _, userID := range userIDs {
s.notificationSender.FriendInfoUpdatedNotification(noCancelCtx, req.UserID, userID)
for _, ownerUserID := range ownerUserIDs {
s.notificationSender.FriendInfoUpdatedNotification(noCancelCtx, req.UserID, ownerUserID)
}
})
if err != nil {

@ -185,6 +185,7 @@ func (s *userServer) applyPhoneVisibility(ctx context.Context, viewerID string,
for i, db := range dbUsers {
pb := pbUsers[i]
if db.Phone == "" {
pb.AreaCode = ""
// 未设置手机号,直接跳过
continue
}
@ -194,6 +195,7 @@ func (s *userServer) applyPhoneVisibility(ctx context.Context, viewerID string,
case tablerelation.PhoneVisibilityHidden:
// 完全隐藏:即使本人也不通过此接口暴露,客户端自行从个人设置接口获取
pb.Phone = ""
pb.AreaCode = ""
case tablerelation.PhoneVisibilityFriends:
// 仅好友可见
if viewerID == db.UserID {
@ -208,9 +210,11 @@ func (s *userServer) applyPhoneVisibility(ctx context.Context, viewerID string,
}
if !isFriend {
pb.Phone = ""
pb.AreaCode = ""
}
default:
pb.Phone = ""
pb.AreaCode = ""
}
}
return nil
@ -335,6 +339,13 @@ func (s *userServer) SetPhoneVisibility(ctx context.Context, req *pbuser.SetPhon
return nil, err
}
s.friendNotificationSender.UserInfoUpdatedNotification(ctx, req.UserID)
if _, err := s.relationClient.NotificationUserInfoUpdate(ctx, &friendpb.NotificationUserInfoUpdateReq{
UserID: req.UserID,
}); err != nil {
log.ZError(ctx, "SetPhoneVisibility: NotificationUserInfoUpdate failed", err, "userID", req.UserID)
return nil, err
}
return &pbuser.SetPhoneVisibilityResp{}, nil
}

Loading…
Cancel
Save