mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-08-24 06:41:59 +08:00
WsVerifyToken
This commit is contained in:
parent
638d2d4282
commit
caf5b0d7c7
@ -13,7 +13,6 @@ import (
|
|||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/relation"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/relation"
|
||||||
tablerelation "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
|
tablerelation "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/tx"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/tx"
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/mcontext"
|
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/tokenverify"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/tokenverify"
|
||||||
registry "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
|
registry "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
|
||||||
@ -94,14 +93,14 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbuser.UpdateUserI
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
_ = s.notificationSender.UserInfoUpdatedNotification(ctx, req.UserInfo.UserID)
|
||||||
friends, err := s.friendRpcClient.GetFriendIDs(ctx, req.UserInfo.UserID)
|
friends, err := s.friendRpcClient.GetFriendIDs(ctx, req.UserInfo.UserID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
for _, v := range friends {
|
for _, friendID := range friends {
|
||||||
s.notificationSender.FriendInfoUpdatedNotification(ctx, req.UserInfo.UserID, v, mcontext.GetOpUserID(ctx))
|
s.notificationSender.FriendInfoUpdatedNotification(ctx, req.UserInfo.UserID, friendID)
|
||||||
}
|
}
|
||||||
s.notificationSender.UserInfoUpdatedNotification(ctx, mcontext.GetOpUserID(ctx), req.UserInfo.UserID)
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +115,7 @@ func (s *userServer) SetGlobalRecvMessageOpt(ctx context.Context, req *pbuser.Se
|
|||||||
if err := s.UpdateByMap(ctx, req.UserID, m); err != nil {
|
if err := s.UpdateByMap(ctx, req.UserID, m); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
s.notificationSender.UserInfoUpdatedNotification(ctx, req.UserID, req.UserID)
|
s.notificationSender.UserInfoUpdatedNotification(ctx, req.UserID)
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package notification
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/mcontext"
|
||||||
|
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/convert"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/convert"
|
||||||
@ -91,9 +92,9 @@ func (f *FriendNotificationSender) getFromToUserNickname(ctx context.Context, fr
|
|||||||
return users[fromUserID].Nickname, users[toUserID].Nickname, nil
|
return users[fromUserID].Nickname, users[toUserID].Nickname, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *FriendNotificationSender) UserInfoUpdatedNotification(ctx context.Context, opUserID string, changedUserID string) error {
|
func (f *FriendNotificationSender) UserInfoUpdatedNotification(ctx context.Context, changedUserID string) error {
|
||||||
tips := sdkws.UserInfoUpdatedTips{UserID: changedUserID}
|
tips := sdkws.UserInfoUpdatedTips{UserID: changedUserID}
|
||||||
return f.Notification(ctx, opUserID, changedUserID, constant.UserInfoUpdatedNotification, &tips)
|
return f.Notification(ctx, mcontext.GetOpUserID(ctx), changedUserID, constant.UserInfoUpdatedNotification, &tips)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *FriendNotificationSender) FriendApplicationAddNotification(ctx context.Context, req *pbFriend.ApplyToAddFriendReq) error {
|
func (f *FriendNotificationSender) FriendApplicationAddNotification(ctx context.Context, req *pbFriend.ApplyToAddFriendReq) error {
|
||||||
@ -171,7 +172,7 @@ func (c *FriendNotificationSender) BlackDeletedNotification(ctx context.Context,
|
|||||||
c.Notification(ctx, req.OwnerUserID, req.BlackUserID, constant.BlackDeletedNotification, &blackDeletedTips)
|
c.Notification(ctx, req.OwnerUserID, req.BlackUserID, constant.BlackDeletedNotification, &blackDeletedTips)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FriendNotificationSender) FriendInfoUpdatedNotification(ctx context.Context, changedUserID string, needNotifiedUserID string, opUserID string) {
|
func (c *FriendNotificationSender) FriendInfoUpdatedNotification(ctx context.Context, changedUserID string, needNotifiedUserID string) {
|
||||||
tips := sdkws.UserInfoUpdatedTips{UserID: changedUserID}
|
tips := sdkws.UserInfoUpdatedTips{UserID: changedUserID}
|
||||||
c.Notification(ctx, opUserID, needNotifiedUserID, constant.FriendInfoUpdatedNotification, &tips)
|
c.Notification(ctx, mcontext.GetOpUserID(ctx), needNotifiedUserID, constant.FriendInfoUpdatedNotification, &tips)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user