diff --git a/internal/push/logic/push_to_client.go b/internal/push/logic/push_to_client.go index a096e4eb4..fe7acbc64 100644 --- a/internal/push/logic/push_to_client.go +++ b/internal/push/logic/push_to_client.go @@ -19,6 +19,7 @@ import ( pbRtc "Open_IM/pkg/proto/rtc" "Open_IM/pkg/utils" "context" + "encoding/json" "strings" promePkg "Open_IM/pkg/common/prometheus" @@ -179,6 +180,16 @@ func MsgToSuperGroupUser(pushMsg *pbPush.PushMsgReq) { } pushToUserIDList = userIDList } + if pushMsg.MsgData.ContentType == constant.SuperGroupUpdateNotification { + m := make(map[string]bool) + _ = json.Unmarshal(pushMsg.MsgData.Content, &m) + if value, ok := m["kicked"]; ok { + if value { + pushToUserIDList = append(pushToUserIDList, pushMsg.MsgData.SendID) + } + } + + } grpcCons := getcdv3.GetDefaultGatewayConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), pushMsg.OperationID) diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index 64cddba02..67c0e15d9 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -277,7 +277,7 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR } go func() { for _, v := range okUserIDList { - chat.SuperGroupNotification(req.OperationID, v, v) + chat.SuperGroupNotification(req.OperationID, v, v, false) } }() } @@ -536,7 +536,7 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite } } for _, v := range req.InvitedUserIDList { - chat.SuperGroupNotification(req.OperationID, v, v) + chat.SuperGroupNotification(req.OperationID, v, v, false) } } @@ -741,7 +741,7 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou } go func() { for _, v := range req.KickedUserIDList { - chat.SuperGroupNotification(req.OperationID, v, v) + chat.SuperGroupNotification(req.OperationID, v, v, true) } }() @@ -1162,7 +1162,7 @@ func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq) if err := rocksCache.DelGroupMemberListHashFromCache(req.GroupID); err != nil { log.NewError(req.OperationID, utils.GetSelfFuncName(), req.GroupID, err.Error()) } - chat.SuperGroupNotification(req.OperationID, req.OpUserID, req.OpUserID) + chat.SuperGroupNotification(req.OperationID, req.OpUserID, req.OpUserID, false) } log.NewInfo(req.OperationID, "rpc QuitGroup return ", pbGroup.QuitGroupResp{CommonResp: &pbGroup.CommonResp{}}) return &pbGroup.QuitGroupResp{CommonResp: &pbGroup.CommonResp{}}, nil diff --git a/internal/rpc/msg/super_group_notification.go b/internal/rpc/msg/super_group_notification.go index f1966a586..aae7c3a22 100644 --- a/internal/rpc/msg/super_group_notification.go +++ b/internal/rpc/msg/super_group_notification.go @@ -9,7 +9,9 @@ import ( //"github.com/golang/protobuf/proto" ) -func SuperGroupNotification(operationID, sendID, recvID string) { +func SuperGroupNotification(operationID, sendID, recvID string, isKicked bool) { + m := make(map[string]bool) + m["kicked"] = isKicked n := &NotificationMsg{ SendID: sendID, RecvID: recvID, @@ -18,6 +20,8 @@ func SuperGroupNotification(operationID, sendID, recvID string) { SessionType: constant.SingleChatType, OperationID: operationID, } + n.Content = utils.StructToJsonBytes(m) + log.NewInfo(operationID, utils.GetSelfFuncName(), string(n.Content)) Notification(n) }