From 233c2f586cf8ee4a70617256fc4830266f4b7ff0 Mon Sep 17 00:00:00 2001 From: Gordon <46924906+FGadvancer@users.noreply.github.com> Date: Fri, 21 Jun 2024 09:56:19 +0800 Subject: [PATCH 01/12] fix: sort by id avoid unstable sort friends. --- go.mod | 2 +- go.sum | 4 ++-- internal/push/push_handler.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 2614e0f32..ce21fb281 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible // indirect github.com/mitchellh/mapstructure v1.5.0 github.com/openimsdk/protocol v0.0.69-alpha.17 - github.com/openimsdk/tools v0.0.49-alpha.25 + github.com/openimsdk/tools v0.0.49-alpha.27 github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_golang v1.18.0 github.com/stretchr/testify v1.9.0 diff --git a/go.sum b/go.sum index fe4f0c390..829dedf0b 100644 --- a/go.sum +++ b/go.sum @@ -272,8 +272,8 @@ github.com/openimsdk/gomake v0.0.13 h1:xLDe/moqgWpRoptHzI4packAWzs4C16b+sVY+txNJ github.com/openimsdk/gomake v0.0.13/go.mod h1:PndCozNc2IsQIciyn9mvEblYWZwJmAI+06z94EY+csI= github.com/openimsdk/protocol v0.0.69-alpha.17 h1:pEag4ZdlovE+AyLsw1VYFU/3sk6ayvGdPzgufQfKf9M= github.com/openimsdk/protocol v0.0.69-alpha.17/go.mod h1:OZQA9FR55lseYoN2Ql1XAHYKHJGu7OMNkUbuekrKCM8= -github.com/openimsdk/tools v0.0.49-alpha.25 h1:OpRPwDZ2xWX7Zj5kyfZhryu/NfZTrsRVr2GFwu1HQHI= -github.com/openimsdk/tools v0.0.49-alpha.25/go.mod h1:rwsFI1G/nBHNfiNapbven41akRDPBbH4df0Cgy6xueU= +github.com/openimsdk/tools v0.0.49-alpha.27 h1:y1hkksh5HVUF/hHTfmVz0U6fIltP+GCYHT0vU+9sC5Q= +github.com/openimsdk/tools v0.0.49-alpha.27/go.mod h1:rwsFI1G/nBHNfiNapbven41akRDPBbH4df0Cgy6xueU= github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ= diff --git a/internal/push/push_handler.go b/internal/push/push_handler.go index 03c299b7a..dfe0e7b55 100644 --- a/internal/push/push_handler.go +++ b/internal/push/push_handler.go @@ -180,7 +180,7 @@ func (c *ConsumerHandler) shouldPushOffline(_ context.Context, msg *sdkws.MsgDat } func (c *ConsumerHandler) Push2Group(ctx context.Context, groupID string, msg *sdkws.MsgData) (err error) { - log.ZDebug(ctx, "Get super group msg from msg_transfer and push msg", "msg", msg.String(), "groupID", groupID) + log.ZDebug(ctx, "Get group msg from msg_transfer and push msg", "msg", msg.String(), "groupID", groupID) var pushToUserIDs []string if err = c.webhookBeforeGroupOnlinePush(ctx, &c.config.WebhooksConfig.BeforeGroupOnlinePush, groupID, msg, &pushToUserIDs); err != nil { From f5721514750612e1095ac86e468e97e5a32b6ddd Mon Sep 17 00:00:00 2001 From: Gordon <46924906+FGadvancer@users.noreply.github.com> Date: Fri, 21 Jun 2024 14:32:00 +0800 Subject: [PATCH 02/12] test: test log add. --- internal/rpc/group/group.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index 5b82b8ceb..a7dc24a91 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -217,11 +217,12 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbgroup.CreateGroupR return nil, err } userIDs := append(append(req.MemberUserIDs, req.AdminUserIDs...), req.OwnerUserID) + log.ZDebug(ctx, "userID test", "userIDs", userIDs) opUserID := mcontext.GetOpUserID(ctx) if !datautil.Contain(opUserID, userIDs...) { userIDs = append(userIDs, opUserID) } - + log.ZDebug(ctx, "userID test", "userIDs", userIDs) if datautil.Duplicate(userIDs) { return nil, errs.ErrArgs.WrapMsg("group member repeated") } From 6249445031b7fb5c7861af03f93ab60e1c181fff Mon Sep 17 00:00:00 2001 From: Gordon <46924906+FGadvancer@users.noreply.github.com> Date: Fri, 21 Jun 2024 14:48:12 +0800 Subject: [PATCH 03/12] test: debug log remove. --- internal/rpc/group/group.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index a7dc24a91..5b82b8ceb 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -217,12 +217,11 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbgroup.CreateGroupR return nil, err } userIDs := append(append(req.MemberUserIDs, req.AdminUserIDs...), req.OwnerUserID) - log.ZDebug(ctx, "userID test", "userIDs", userIDs) opUserID := mcontext.GetOpUserID(ctx) if !datautil.Contain(opUserID, userIDs...) { userIDs = append(userIDs, opUserID) } - log.ZDebug(ctx, "userID test", "userIDs", userIDs) + if datautil.Duplicate(userIDs) { return nil, errs.ErrArgs.WrapMsg("group member repeated") } From 0539a3831004680c08d0bb53af2b7edd252ab58e Mon Sep 17 00:00:00 2001 From: Gordon <46924906+FGadvancer@users.noreply.github.com> Date: Fri, 21 Jun 2024 19:51:00 +0800 Subject: [PATCH 04/12] fix: transfer group owner incr version more than 1. --- pkg/common/storage/controller/group.go | 5 +---- pkg/common/storage/database/group_member.go | 1 + .../storage/database/mgo/group_member.go | 19 ++++++++++++++++++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/pkg/common/storage/controller/group.go b/pkg/common/storage/controller/group.go index 27b6f4366..f2581bd92 100644 --- a/pkg/common/storage/controller/group.go +++ b/pkg/common/storage/controller/group.go @@ -400,10 +400,7 @@ func (g *groupDatabase) MapGroupMemberNum(ctx context.Context, groupIDs []string func (g *groupDatabase) TransferGroupOwner(ctx context.Context, groupID string, oldOwnerUserID, newOwnerUserID string, roleLevel int32) error { return g.ctxTx.Transaction(ctx, func(ctx context.Context) error { - if err := g.groupMemberDB.UpdateRoleLevel(ctx, groupID, oldOwnerUserID, roleLevel); err != nil { - return err - } - if err := g.groupMemberDB.UpdateRoleLevel(ctx, groupID, newOwnerUserID, constant.GroupOwner); err != nil { + if err := g.groupMemberDB.UpdateUserRoleLevels(ctx, groupID, oldOwnerUserID, roleLevel, newOwnerUserID, constant.GroupOwner); err != nil { return err } c := g.cache.CloneGroupCache() diff --git a/pkg/common/storage/database/group_member.go b/pkg/common/storage/database/group_member.go index c49319649..c272b6ef6 100644 --- a/pkg/common/storage/database/group_member.go +++ b/pkg/common/storage/database/group_member.go @@ -25,6 +25,7 @@ type GroupMember interface { Delete(ctx context.Context, groupID string, userIDs []string) (err error) Update(ctx context.Context, groupID string, userID string, data map[string]any) (err error) UpdateRoleLevel(ctx context.Context, groupID string, userID string, roleLevel int32) error + UpdateUserRoleLevels(ctx context.Context, groupID string, firstUserID string, firstUserRoleLevel int32, secondUserID string, secondUserRoleLevel int32) error FindMemberUserID(ctx context.Context, groupID string) (userIDs []string, err error) Take(ctx context.Context, groupID string, userID string) (groupMember *model.GroupMember, err error) TakeOwner(ctx context.Context, groupID string) (groupMember *model.GroupMember, err error) diff --git a/pkg/common/storage/database/mgo/group_member.go b/pkg/common/storage/database/mgo/group_member.go index 30f8d63b9..3eb93a10e 100644 --- a/pkg/common/storage/database/mgo/group_member.go +++ b/pkg/common/storage/database/mgo/group_member.go @@ -115,11 +115,28 @@ func (g *GroupMemberMgo) Delete(ctx context.Context, groupID string, userIDs []s func (g *GroupMemberMgo) UpdateRoleLevel(ctx context.Context, groupID string, userID string, roleLevel int32) error { return mongoutil.IncrVersion(func() error { - return g.Update(ctx, groupID, userID, bson.M{"role_level": roleLevel}) + return mongoutil.UpdateOne(ctx, g.coll, bson.M{"group_id": groupID, "user_id": userID}, + bson.M{"$set": bson.M{"role_level": roleLevel}}, true) }, func() error { return g.member.IncrVersion(ctx, groupID, []string{userID}, model.VersionStateUpdate) }) } +func (g *GroupMemberMgo) UpdateUserRoleLevels(ctx context.Context, groupID string, firstUserID string, firstUserRoleLevel int32, secondUserID string, secondUserRoleLevel int32) error { + return mongoutil.IncrVersion(func() error { + if err := mongoutil.UpdateOne(ctx, g.coll, bson.M{"group_id": groupID, "user_id": firstUserID}, + bson.M{"$set": bson.M{"role_level": firstUserRoleLevel}}, true); err != nil { + return err + } + if err := mongoutil.UpdateOne(ctx, g.coll, bson.M{"group_id": groupID, "user_id": secondUserID}, + bson.M{"$set": bson.M{"role_level": secondUserRoleLevel}}, true); err != nil { + return err + } + + return nil + }, func() error { + return g.member.IncrVersion(ctx, groupID, []string{firstUserID, secondUserID}, model.VersionStateUpdate) + }) +} func (g *GroupMemberMgo) Update(ctx context.Context, groupID string, userID string, data map[string]any) (err error) { if len(data) == 0 { From b3510e285a4681f4babbfbeb0c838eed99991514 Mon Sep 17 00:00:00 2001 From: Monet Lee Date: Mon, 24 Jun 2024 10:13:46 +0800 Subject: [PATCH 05/12] fix: add condition to kick owner. --- internal/rpc/group/group.go | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index 5b82b8ceb..1e36889c7 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -17,17 +17,18 @@ package group import ( "context" "fmt" + "math/big" + "math/rand" + "strconv" + "strings" + "time" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/common" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" "github.com/openimsdk/open-im-server/v3/pkg/common/webhook" "github.com/openimsdk/open-im-server/v3/pkg/localcache" - "math/big" - "math/rand" - "strconv" - "strings" - "time" "github.com/openimsdk/open-im-server/v3/pkg/authverify" "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct" @@ -531,6 +532,14 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbgroup.KickGrou if datautil.Contain(opUserID, req.KickedUserIDs...) { return nil, errs.ErrArgs.WrapMsg("opUserID in KickedUserIDs") } + owner, err := s.db.TakeGroupOwner(ctx, req.GroupID) + if err != nil { + return nil, err + } + if datautil.Contain(owner.UserID, req.KickedUserIDs...) { + return nil, errs.ErrArgs.WrapMsg("ownerUID can not Kick") + } + members, err := s.db.FindGroupMembers(ctx, req.GroupID, append(req.KickedUserIDs, opUserID)) if err != nil { return nil, err From 21197cc6794e7119e2af4e3bceceb421104be8db Mon Sep 17 00:00:00 2001 From: icey-yu <1186114839@qq.com> Date: Mon, 24 Jun 2024 15:34:08 +0800 Subject: [PATCH 06/12] feat: replace resp nil --- go.mod | 2 +- go.sum | 4 ++-- internal/api/group.go | 4 ++-- pkg/common/storage/controller/friend.go | 3 --- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 4ab39f751..be8e8aefb 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible // indirect github.com/mitchellh/mapstructure v1.5.0 github.com/openimsdk/protocol v0.0.69-alpha.12 - github.com/openimsdk/tools v0.0.49-alpha.25 + github.com/openimsdk/tools v0.0.49-alpha.28 github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_golang v1.18.0 github.com/stretchr/testify v1.9.0 diff --git a/go.sum b/go.sum index a26e59d9e..955328b66 100644 --- a/go.sum +++ b/go.sum @@ -272,8 +272,8 @@ github.com/openimsdk/gomake v0.0.13 h1:xLDe/moqgWpRoptHzI4packAWzs4C16b+sVY+txNJ github.com/openimsdk/gomake v0.0.13/go.mod h1:PndCozNc2IsQIciyn9mvEblYWZwJmAI+06z94EY+csI= github.com/openimsdk/protocol v0.0.69-alpha.12 h1:3ZdwmD1y9vcduIC8o2EZS8Ds/fByqcuEFo+NkcBzgRo= github.com/openimsdk/protocol v0.0.69-alpha.12/go.mod h1:OZQA9FR55lseYoN2Ql1XAHYKHJGu7OMNkUbuekrKCM8= -github.com/openimsdk/tools v0.0.49-alpha.25 h1:OpRPwDZ2xWX7Zj5kyfZhryu/NfZTrsRVr2GFwu1HQHI= -github.com/openimsdk/tools v0.0.49-alpha.25/go.mod h1:rwsFI1G/nBHNfiNapbven41akRDPBbH4df0Cgy6xueU= +github.com/openimsdk/tools v0.0.49-alpha.28 h1:1CfdFxvKzyOIvgNMVMq4ZB2upAJ0evLbbigOhWQzhu8= +github.com/openimsdk/tools v0.0.49-alpha.28/go.mod h1:rwsFI1G/nBHNfiNapbven41akRDPBbH4df0Cgy6xueU= github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ= diff --git a/internal/api/group.go b/internal/api/group.go index 91992004c..5018bf78b 100644 --- a/internal/api/group.go +++ b/internal/api/group.go @@ -66,7 +66,7 @@ func (o *GroupApi) GetGroupUsersReqApplicationList(c *gin.Context) { } func (o *GroupApi) GetGroupsInfo(c *gin.Context) { - a2r.Call(group.GroupClient.GetGroupsInfo, o.Client, c) + a2r.Call(group.GroupClient.GetGroupsInfo, o.Client, c, a2r.NewNilReplaceOption(group.GroupClient.GetGroupsInfo)) } func (o *GroupApi) KickGroupMember(c *gin.Context) { @@ -74,7 +74,7 @@ func (o *GroupApi) KickGroupMember(c *gin.Context) { } func (o *GroupApi) GetGroupMembersInfo(c *gin.Context) { - a2r.Call(group.GroupClient.GetGroupMembersInfo, o.Client, c) + a2r.Call(group.GroupClient.GetGroupMembersInfo, o.Client, c, a2r.NewNilReplaceOption(group.GroupClient.GetGroupMembersInfo)) } func (o *GroupApi) GetGroupMemberList(c *gin.Context) { diff --git a/pkg/common/storage/controller/friend.go b/pkg/common/storage/controller/friend.go index 42c230598..d85b3153c 100644 --- a/pkg/common/storage/controller/friend.go +++ b/pkg/common/storage/controller/friend.go @@ -335,9 +335,6 @@ func (f *friendDatabase) FindFriendsWithError(ctx context.Context, ownerUserID s if err != nil { return } - if len(friends) != len(friendUserIDs) { - err = errs.ErrRecordNotFound.Wrap() - } return } From d25eb4c53c9f3589baafac43966fa2b1529121f4 Mon Sep 17 00:00:00 2001 From: icey-yu <1186114839@qq.com> Date: Mon, 24 Jun 2024 15:47:17 +0800 Subject: [PATCH 07/12] feat: replace nil --- internal/api/friend.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/api/friend.go b/internal/api/friend.go index 9266fe75c..33449e441 100644 --- a/internal/api/friend.go +++ b/internal/api/friend.go @@ -56,7 +56,7 @@ func (o *FriendApi) GetFriendList(c *gin.Context) { } func (o *FriendApi) GetDesignatedFriends(c *gin.Context) { - a2r.Call(relation.FriendClient.GetDesignatedFriends, o.Client, c) + a2r.Call(relation.FriendClient.GetDesignatedFriends, o.Client, c, a2r.NewNilReplaceOption(relation.FriendClient.GetDesignatedFriends)) } func (o *FriendApi) SetFriendRemark(c *gin.Context) { From da8cd97bab6b32550f9c5ed83904ddda66501ca3 Mon Sep 17 00:00:00 2001 From: Gordon <46924906+FGadvancer@users.noreply.github.com> Date: Tue, 25 Jun 2024 15:36:49 +0800 Subject: [PATCH 08/12] fix: delete cache of max group joined version avoid sync joined group failed. --- pkg/common/storage/controller/group.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/common/storage/controller/group.go b/pkg/common/storage/controller/group.go index f2581bd92..3a5f48d4c 100644 --- a/pkg/common/storage/controller/group.go +++ b/pkg/common/storage/controller/group.go @@ -378,6 +378,7 @@ func (g *groupDatabase) DeleteGroupMember(ctx context.Context, groupID string, u DelGroupMembersInfo(groupID, userIDs...). DelGroupAllRoleLevel(groupID). DelMaxGroupMemberVersion(groupID). + DelMaxJoinGroupVersion(userIDs...). ChainExecDel(ctx) }) } From 355ebe8cfa00c8a3eb8a7dcd6b9b8b4f25129480 Mon Sep 17 00:00:00 2001 From: icey-yu <1186114839@qq.com> Date: Tue, 25 Jun 2024 16:26:10 +0800 Subject: [PATCH 09/12] fix: nil --- internal/api/friend.go | 3 ++- internal/api/group.go | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/api/friend.go b/internal/api/friend.go index 33449e441..11d7375fa 100644 --- a/internal/api/friend.go +++ b/internal/api/friend.go @@ -56,7 +56,8 @@ func (o *FriendApi) GetFriendList(c *gin.Context) { } func (o *FriendApi) GetDesignatedFriends(c *gin.Context) { - a2r.Call(relation.FriendClient.GetDesignatedFriends, o.Client, c, a2r.NewNilReplaceOption(relation.FriendClient.GetDesignatedFriends)) + a2r.Call(relation.FriendClient.GetDesignatedFriends, o.Client, c) + //a2r.Call(relation.FriendClient.GetDesignatedFriends, o.Client, c, a2r.NewNilReplaceOption(relation.FriendClient.GetDesignatedFriends)) } func (o *FriendApi) SetFriendRemark(c *gin.Context) { diff --git a/internal/api/group.go b/internal/api/group.go index 5018bf78b..e48191ee1 100644 --- a/internal/api/group.go +++ b/internal/api/group.go @@ -66,7 +66,8 @@ func (o *GroupApi) GetGroupUsersReqApplicationList(c *gin.Context) { } func (o *GroupApi) GetGroupsInfo(c *gin.Context) { - a2r.Call(group.GroupClient.GetGroupsInfo, o.Client, c, a2r.NewNilReplaceOption(group.GroupClient.GetGroupsInfo)) + a2r.Call(group.GroupClient.GetGroupsInfo, o.Client, c) + //a2r.Call(group.GroupClient.GetGroupsInfo, o.Client, c, a2r.NewNilReplaceOption(group.GroupClient.GetGroupsInfo)) } func (o *GroupApi) KickGroupMember(c *gin.Context) { @@ -74,7 +75,8 @@ func (o *GroupApi) KickGroupMember(c *gin.Context) { } func (o *GroupApi) GetGroupMembersInfo(c *gin.Context) { - a2r.Call(group.GroupClient.GetGroupMembersInfo, o.Client, c, a2r.NewNilReplaceOption(group.GroupClient.GetGroupMembersInfo)) + a2r.Call(group.GroupClient.GetGroupMembersInfo, o.Client, c) + //a2r.Call(group.GroupClient.GetGroupMembersInfo, o.Client, c, a2r.NewNilReplaceOption(group.GroupClient.GetGroupMembersInfo)) } func (o *GroupApi) GetGroupMemberList(c *gin.Context) { From a41667cd82a4df09785c7eb1c77265254b503aed Mon Sep 17 00:00:00 2001 From: Gordon <46924906+FGadvancer@users.noreply.github.com> Date: Tue, 25 Jun 2024 18:07:22 +0800 Subject: [PATCH 10/12] fix: delete cache of max group joined version avoid sync joined group failed. --- internal/rpc/msg/seq.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/rpc/msg/seq.go b/internal/rpc/msg/seq.go index 27465c210..1ebec4a71 100644 --- a/internal/rpc/msg/seq.go +++ b/internal/rpc/msg/seq.go @@ -16,13 +16,15 @@ package msg import ( "context" + "github.com/openimsdk/tools/errs" + "github.com/redis/go-redis/v9" pbmsg "github.com/openimsdk/protocol/msg" ) func (m *msgServer) GetConversationMaxSeq(ctx context.Context, req *pbmsg.GetConversationMaxSeqReq) (*pbmsg.GetConversationMaxSeqResp, error) { maxSeq, err := m.MsgDatabase.GetMaxSeq(ctx, req.ConversationID) - if err != nil { + if err != nil && errs.Unwrap(err) != redis.Nil { return nil, err } return &pbmsg.GetConversationMaxSeqResp{MaxSeq: maxSeq}, nil From 1b080fe14d4618724b18b26594202217542fe7d6 Mon Sep 17 00:00:00 2001 From: Gordon <46924906+FGadvancer@users.noreply.github.com> Date: Tue, 25 Jun 2024 19:17:26 +0800 Subject: [PATCH 11/12] fix: delete cache of max group joined version avoid sync joined group failed. --- internal/rpc/group/group.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index 1e36889c7..e3d1d4dfe 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -599,7 +599,7 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbgroup.KickGrou FaceURL: group.FaceURL, OwnerUserID: ownerUserID, CreateTime: group.CreateTime.UnixMilli(), - MemberCount: num, + MemberCount: num - uint32(len(req.KickedUserIDs)), Ex: group.Ex, Status: group.Status, CreatorUserID: group.CreatorUserID, From 5df00a3f97073bb70650f5b1f1ee15c2dace81ef Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Tue, 25 Jun 2024 20:28:13 +0800 Subject: [PATCH 12/12] return group information for any changes --- internal/rpc/group/sync.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/rpc/group/sync.go b/internal/rpc/group/sync.go index 3793d0c7e..75d060c0e 100644 --- a/internal/rpc/group/sync.go +++ b/internal/rpc/group/sync.go @@ -82,6 +82,9 @@ func (s *groupServer) GetIncrementalGroupMember(ctx context.Context, req *pbgrou } return false }) + if vl.LogLen > 0 { + hasGroupUpdate = true + } return vl, nil }, CacheMaxVersion: s.db.FindMaxGroupMemberVersionCache,