From d77b772fb246dc7a81fbd95024ad837388a3e71c Mon Sep 17 00:00:00 2001 From: AndrewZuo01 Date: Wed, 27 Dec 2023 10:58:02 +0800 Subject: [PATCH] update notification --- internal/rpc/friend/friend.go | 6 +----- internal/rpc/user/user.go | 4 ---- pkg/common/config/config.go | 1 - pkg/rpcclient/msg.go | 2 +- pkg/rpcclient/notification/friend.go | 3 ++- 5 files changed, 4 insertions(+), 12 deletions(-) diff --git a/internal/rpc/friend/friend.go b/internal/rpc/friend/friend.go index faa447227..dad0c6fe0 100644 --- a/internal/rpc/friend/friend.go +++ b/internal/rpc/friend/friend.go @@ -53,10 +53,6 @@ type friendServer struct { RegisterCenter registry.SvcDiscoveryRegistry } -func (s *friendServer) UpdateFriends(ctx context.Context, req *pbfriend.UpdateFriendsReq) (*pbfriend.UpdateFriendsResp, error) { - return nil, errs.ErrInternalServer.Wrap("not implemented") -} - func Start(client registry.SvcDiscoveryRegistry, server *grpc.Server) error { // Initialize MongoDB mongo, err := unrelation.NewMongo() @@ -476,6 +472,6 @@ func (s *friendServer) UpdateFriends( resp := &pbfriend.UpdateFriendsResp{} - s.notificationSender.FriendsInfoUpdateNotification(ctx, req.OwnerUserID) + s.notificationSender.FriendsInfoUpdateNotification(ctx, req.OwnerUserID, req.FriendUserIDs) return resp, nil } diff --git a/internal/rpc/user/user.go b/internal/rpc/user/user.go index de13467d8..fd9abf0cb 100644 --- a/internal/rpc/user/user.go +++ b/internal/rpc/user/user.go @@ -57,10 +57,6 @@ type userServer struct { RegisterCenter registry.SvcDiscoveryRegistry } -func (s *userServer) UpdateUserInfoEx(ctx context.Context, req *pbuser.UpdateUserInfoExReq) (*pbuser.UpdateUserInfoExResp, error) { - return nil, errs.ErrInternalServer.Wrap("not implemented") -} - func Start(client registry.SvcDiscoveryRegistry, server *grpc.Server) error { rdb, err := cache.NewRedis() if err != nil { diff --git a/pkg/common/config/config.go b/pkg/common/config/config.go index 364a30ab6..ea26ca677 100644 --- a/pkg/common/config/config.go +++ b/pkg/common/config/config.go @@ -365,7 +365,6 @@ type notification struct { BlackAdded NotificationConf `yaml:"blackAdded"` BlackDeleted NotificationConf `yaml:"blackDeleted"` FriendInfoUpdated NotificationConf `yaml:"friendInfoUpdated"` - FriendsInfoUpdate NotificationConf `yaml:"friendsInfoUpdate"` //////////////////////conversation/////////////////////// ConversationChanged NotificationConf `yaml:"conversationChanged"` ConversationSetPrivate NotificationConf `yaml:"conversationSetPrivate"` diff --git a/pkg/rpcclient/msg.go b/pkg/rpcclient/msg.go index ee9a6ef01..30bd94863 100644 --- a/pkg/rpcclient/msg.go +++ b/pkg/rpcclient/msg.go @@ -68,7 +68,7 @@ func newContentTypeConf() map[int32]config.NotificationConf { constant.BlackAddedNotification: config.Config.Notification.BlackAdded, constant.BlackDeletedNotification: config.Config.Notification.BlackDeleted, constant.FriendInfoUpdatedNotification: config.Config.Notification.FriendInfoUpdated, - constant.FriendsInfoUpdateNotification: config.Config.Notification.FriendsInfoUpdate, + constant.FriendsInfoUpdateNotification: config.Config.Notification.FriendInfoUpdated, //use the same FriendInfoUpdated // conversation constant.ConversationChangeNotification: config.Config.Notification.ConversationChanged, constant.ConversationUnreadNotification: config.Config.Notification.ConversationChanged, diff --git a/pkg/rpcclient/notification/friend.go b/pkg/rpcclient/notification/friend.go index 3e26b3038..00759b1b2 100644 --- a/pkg/rpcclient/notification/friend.go +++ b/pkg/rpcclient/notification/friend.go @@ -196,9 +196,10 @@ func (f *FriendNotificationSender) FriendRemarkSetNotification(ctx context.Conte tips.FromToUserID.ToUserID = toUserID return f.Notification(ctx, fromUserID, toUserID, constant.FriendRemarkSetNotification, &tips) } -func (f *FriendNotificationSender) FriendsInfoUpdateNotification(ctx context.Context, toUserID string) error { +func (f *FriendNotificationSender) FriendsInfoUpdateNotification(ctx context.Context, toUserID string, friendIDs []string) error { tips := sdkws.FriendsInfoUpdateTips{} tips.FromToUserID.ToUserID = toUserID + tips.FriendIDs = friendIDs return f.Notification(ctx, toUserID, toUserID, constant.FriendsInfoUpdateNotification, &tips) } func (f *FriendNotificationSender) BlackAddedNotification(ctx context.Context, req *pbfriend.AddBlackReq) error {