From d7532347ad30d03158caf51d0f72607e290c86dc Mon Sep 17 00:00:00 2001 From: pluto <2631223275@qq.com> Date: Thu, 31 Aug 2023 16:38:15 +0800 Subject: [PATCH 01/10] fix:sent message already has a timestamp, no timestamp will be generated (#982) --- internal/rpc/msg/verify.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/rpc/msg/verify.go b/internal/rpc/msg/verify.go index 7297dc83b..de85775d8 100644 --- a/internal/rpc/msg/verify.go +++ b/internal/rpc/msg/verify.go @@ -128,7 +128,9 @@ func (m *msgServer) messageVerification(ctx context.Context, data *msg.SendMsgRe func (m *msgServer) encapsulateMsgData(msg *sdkws.MsgData) { msg.ServerMsgID = GetMsgID(msg.SendID) - msg.SendTime = utils.GetCurrentTimestampByMill() + if msg.SendTime == 0 { + msg.SendTime = utils.GetCurrentTimestampByMill() + } switch msg.ContentType { case constant.Text: fallthrough From 687614d3f432ab5629b97b35d37f76e25349a898 Mon Sep 17 00:00:00 2001 From: pluto <2631223275@qq.com> Date: Thu, 31 Aug 2023 16:38:35 +0800 Subject: [PATCH 02/10] refactor:Optimization of text messages when accepting message req (#981) --- internal/api/msg.go | 7 +------ pkg/apistruct/msg.go | 5 +---- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/internal/api/msg.go b/internal/api/msg.go index 2bbae9765..726889d56 100644 --- a/internal/api/msg.go +++ b/internal/api/msg.go @@ -170,12 +170,7 @@ func (m *MessageApi) getSendMsgReq(c *gin.Context, req apistruct.SendMsg) (sendM log.ZDebug(c, "getSendMsgReq", "req", req.Content) switch req.ContentType { case constant.Text: - text, ok := req.Content["text"].(string) - if !ok { - return nil, errs.ErrArgs.WithDetail("text is not string") - } - data = apistruct.TextContentElem{Content: text} - log.ZDebug(c, "getSendMsgReq", "data", data) + data = apistruct.TextElem{} case constant.Picture: data = apistruct.PictureElem{} case constant.Voice: diff --git a/pkg/apistruct/msg.go b/pkg/apistruct/msg.go index d31752f38..12cf253a0 100644 --- a/pkg/apistruct/msg.go +++ b/pkg/apistruct/msg.go @@ -72,11 +72,8 @@ type CustomElem struct { Description string `mapstructure:"description"` Extension string `mapstructure:"extension"` } -type TextElem struct { - Text string `mapstructure:"text" validate:"required"` -} -type TextContentElem struct { +type TextElem struct { Content string `json:"content" validate:"required"` } From 6fc15d4f7af5f1cb01dcc35afda2179eec66a859 Mon Sep 17 00:00:00 2001 From: pluto <2631223275@qq.com> Date: Thu, 31 Aug 2023 16:58:40 +0800 Subject: [PATCH 03/10] refactor:Returns [] an empty array when no platform is online, instead of null (#970) --- pkg/common/db/cache/user.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/common/db/cache/user.go b/pkg/common/db/cache/user.go index 61b4df9d8..2db5e2190 100644 --- a/pkg/common/db/cache/user.go +++ b/pkg/common/db/cache/user.go @@ -244,7 +244,7 @@ func (u *UserCacheRedis) SetUserStatus(ctx context.Context, list []*user.OnlineS } if newPlatformIDs == nil { onlineStatus.Status = constant.Offline - onlineStatus.PlatformIDs = nil + onlineStatus.PlatformIDs = []int32{} newjsonData, err := json.Marshal(&onlineStatus) if err != nil { return errs.Wrap(err) From 4ce4548ca1afe11c42507d732ffeb5f6324e6afc Mon Sep 17 00:00:00 2001 From: withchao <48119764+withchao@users.noreply.github.com> Date: Fri, 1 Sep 2023 10:16:09 +0800 Subject: [PATCH 04/10] fix: repeated modification session notification (#991) * fix: create group type limit * fix: group notification * fix: group notification * fix: group notification * chore: group member hash * chore: group member hash * chore: group member hash * chore: group member hash * test: log * test: log * test: log * test: log * test: log * sync: hash code * sync: hash code * sync: hash code * test: log * test: log * test: log * test: log * test: log * fix: time stamp * fix: minio sign endpoint opts * cicd: robot automated Change Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix: minio bucket url * fix: op user info * cicd: robot automated Change Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix: importFriends Conversation * fix: importFriends Notification * cicd: robot automated Change Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix: importFriends Notification * NotificationUserInfoUpdate * NotificationUserInfoUpdate * NotificationUserInfoUpdate * NotificationUserInfoUpdate * NotificationUserInfoUpdate * NotificationUserInfoUpdate * NotificationUserInfoUpdate * TransferGroupOwner del group hash * add GetSpecifiedFriendsInfo * cicd: robot automated Change Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * remove pprop * chore: optimize modification and send notifications --------- Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: withchao --- internal/rpc/conversation/conversaion.go | 39 +++++++++++++++--------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/internal/rpc/conversation/conversaion.go b/internal/rpc/conversation/conversaion.go index d761079e2..4a2575017 100644 --- a/internal/rpc/conversation/conversaion.go +++ b/internal/rpc/conversation/conversaion.go @@ -133,34 +133,42 @@ func (c *conversationServer) SetConversations(ctx context.Context, req *pbconver // } // } } + cs, err := c.conversationDatabase.GetConversationsByConversationID(ctx, []string{req.Conversation.ConversationID}) + if err != nil { + return nil, err + } + if len(cs) == 0 { + return nil, errs.ErrRecordNotFound.Wrap("conversation not found") + } + conv := cs[0] var conversation tablerelation.ConversationModel conversation.ConversationID = req.Conversation.ConversationID conversation.ConversationType = req.Conversation.ConversationType conversation.UserID = req.Conversation.UserID conversation.GroupID = req.Conversation.GroupID m := make(map[string]interface{}) - if req.Conversation.RecvMsgOpt != nil { + if req.Conversation.RecvMsgOpt != nil && req.Conversation.RecvMsgOpt.Value != conv.RecvMsgOpt { m["recv_msg_opt"] = req.Conversation.RecvMsgOpt.Value } - if req.Conversation.AttachedInfo != nil { + if req.Conversation.AttachedInfo != nil && req.Conversation.AttachedInfo.Value != conv.AttachedInfo { m["attached_info"] = req.Conversation.AttachedInfo.Value } - if req.Conversation.Ex != nil { + if req.Conversation.Ex != nil && req.Conversation.Ex.Value != conv.Ex { m["ex"] = req.Conversation.Ex.Value } - if req.Conversation.IsPinned != nil { + if req.Conversation.IsPinned != nil && req.Conversation.IsPinned.Value != conv.IsPinned { m["is_pinned"] = req.Conversation.IsPinned.Value } - if req.Conversation.GroupAtType != nil { + if req.Conversation.GroupAtType != nil && req.Conversation.GroupAtType.Value != conv.GroupAtType { m["group_at_type"] = req.Conversation.GroupAtType.Value } - if req.Conversation.MsgDestructTime != nil { + if req.Conversation.MsgDestructTime != nil && req.Conversation.MsgDestructTime.Value != conv.MsgDestructTime { m["msg_destruct_time"] = req.Conversation.MsgDestructTime.Value } - if req.Conversation.IsMsgDestruct != nil { + if req.Conversation.IsMsgDestruct != nil && req.Conversation.IsMsgDestruct.Value != conv.IsMsgDestruct { m["is_msg_destruct"] = req.Conversation.IsMsgDestruct.Value } - if req.Conversation.IsPrivateChat != nil && req.Conversation.ConversationType != constant.SuperGroupChatType { + if req.Conversation.IsPrivateChat != nil && req.Conversation.ConversationType != constant.SuperGroupChatType && len(m) > 0 { var conversations []*tablerelation.ConversationModel for _, ownerUserID := range req.UserIDs { conversation2 := conversation @@ -175,15 +183,16 @@ func (c *conversationServer) SetConversations(ctx context.Context, req *pbconver c.conversationNotificationSender.ConversationSetPrivateNotification(ctx, userID, req.Conversation.UserID, req.Conversation.IsPrivateChat.Value, req.Conversation.ConversationID) } } - if req.Conversation.BurnDuration != nil { + if req.Conversation.BurnDuration != nil && req.Conversation.BurnDuration.Value != conv.BurnDuration { m["burn_duration"] = req.Conversation.BurnDuration.Value } - err := c.conversationDatabase.SetUsersConversationFiledTx(ctx, req.UserIDs, &conversation, m) - if err != nil { - return nil, err - } - for _, v := range req.UserIDs { - c.conversationNotificationSender.ConversationChangeNotification(ctx, v, []string{req.Conversation.ConversationID}) + if len(m) > 0 { + if err := c.conversationDatabase.SetUsersConversationFiledTx(ctx, req.UserIDs, &conversation, m); err != nil { + return nil, err + } + for _, v := range req.UserIDs { + c.conversationNotificationSender.ConversationChangeNotification(ctx, v, []string{req.Conversation.ConversationID}) + } } return &pbconversation.SetConversationsResp{}, nil } From 40a4952fe216629baa7f644e5cd834a981c36392 Mon Sep 17 00:00:00 2001 From: withchao <48119764+withchao@users.noreply.github.com> Date: Fri, 1 Sep 2023 15:30:57 +0800 Subject: [PATCH 05/10] chore: optimize modification and send notifications (#992) --- internal/rpc/conversation/conversaion.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/rpc/conversation/conversaion.go b/internal/rpc/conversation/conversaion.go index 4a2575017..d1f4a7fc6 100644 --- a/internal/rpc/conversation/conversaion.go +++ b/internal/rpc/conversation/conversaion.go @@ -133,7 +133,7 @@ func (c *conversationServer) SetConversations(ctx context.Context, req *pbconver // } // } } - cs, err := c.conversationDatabase.GetConversationsByConversationID(ctx, []string{req.Conversation.ConversationID}) + cs, err := c.conversationDatabase.FindConversations(ctx, req.Conversation.UserID, []string{req.Conversation.ConversationID}) if err != nil { return nil, err } From 5d2f2adccf41ada45cd1660e55315c31e91b0bf0 Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Fri, 1 Sep 2023 17:00:33 +0800 Subject: [PATCH 06/10] fix: repeated modification session notification --- internal/rpc/conversation/conversaion.go | 74 +++++++++++++++++------- 1 file changed, 52 insertions(+), 22 deletions(-) diff --git a/internal/rpc/conversation/conversaion.go b/internal/rpc/conversation/conversaion.go index d1f4a7fc6..3d34e7345 100644 --- a/internal/rpc/conversation/conversaion.go +++ b/internal/rpc/conversation/conversaion.go @@ -133,42 +133,67 @@ func (c *conversationServer) SetConversations(ctx context.Context, req *pbconver // } // } } - cs, err := c.conversationDatabase.FindConversations(ctx, req.Conversation.UserID, []string{req.Conversation.ConversationID}) - if err != nil { - return nil, err - } - if len(cs) == 0 { - return nil, errs.ErrRecordNotFound.Wrap("conversation not found") + var unequal int + var conv tablerelation.ConversationModel + if len(req.UserIDs) == 1 { + cs, err := c.conversationDatabase.FindConversations(ctx, req.Conversation.UserID, []string{req.Conversation.ConversationID}) + if err != nil { + return nil, err + } + if len(cs) == 0 { + return nil, errs.ErrRecordNotFound.Wrap("conversation not found") + } + conv = *cs[0] } - conv := cs[0] var conversation tablerelation.ConversationModel conversation.ConversationID = req.Conversation.ConversationID conversation.ConversationType = req.Conversation.ConversationType conversation.UserID = req.Conversation.UserID conversation.GroupID = req.Conversation.GroupID m := make(map[string]interface{}) - if req.Conversation.RecvMsgOpt != nil && req.Conversation.RecvMsgOpt.Value != conv.RecvMsgOpt { + if req.Conversation.RecvMsgOpt != nil { m["recv_msg_opt"] = req.Conversation.RecvMsgOpt.Value + if req.Conversation.RecvMsgOpt.Value != conv.RecvMsgOpt { + unequal++ + } } - if req.Conversation.AttachedInfo != nil && req.Conversation.AttachedInfo.Value != conv.AttachedInfo { + if req.Conversation.AttachedInfo != nil { m["attached_info"] = req.Conversation.AttachedInfo.Value + if req.Conversation.AttachedInfo.Value != conv.AttachedInfo { + unequal++ + } } - if req.Conversation.Ex != nil && req.Conversation.Ex.Value != conv.Ex { + if req.Conversation.Ex != nil { m["ex"] = req.Conversation.Ex.Value + if req.Conversation.Ex.Value != conv.Ex { + unequal++ + } } - if req.Conversation.IsPinned != nil && req.Conversation.IsPinned.Value != conv.IsPinned { + if req.Conversation.IsPinned != nil { m["is_pinned"] = req.Conversation.IsPinned.Value + if req.Conversation.IsPinned.Value != conv.IsPinned { + unequal++ + } } - if req.Conversation.GroupAtType != nil && req.Conversation.GroupAtType.Value != conv.GroupAtType { + if req.Conversation.GroupAtType != nil { m["group_at_type"] = req.Conversation.GroupAtType.Value + if req.Conversation.GroupAtType.Value != conv.GroupAtType { + unequal++ + } } - if req.Conversation.MsgDestructTime != nil && req.Conversation.MsgDestructTime.Value != conv.MsgDestructTime { + if req.Conversation.MsgDestructTime != nil { m["msg_destruct_time"] = req.Conversation.MsgDestructTime.Value + if req.Conversation.MsgDestructTime.Value != conv.MsgDestructTime { + unequal++ + } } - if req.Conversation.IsMsgDestruct != nil && req.Conversation.IsMsgDestruct.Value != conv.IsMsgDestruct { + if req.Conversation.IsMsgDestruct != nil { m["is_msg_destruct"] = req.Conversation.IsMsgDestruct.Value + if req.Conversation.IsMsgDestruct.Value != conv.IsMsgDestruct { + unequal++ + } } - if req.Conversation.IsPrivateChat != nil && req.Conversation.ConversationType != constant.SuperGroupChatType && len(m) > 0 { + if req.Conversation.IsPrivateChat != nil && req.Conversation.ConversationType != constant.SuperGroupChatType { var conversations []*tablerelation.ConversationModel for _, ownerUserID := range req.UserIDs { conversation2 := conversation @@ -179,17 +204,22 @@ func (c *conversationServer) SetConversations(ctx context.Context, req *pbconver if err := c.conversationDatabase.SyncPeerUserPrivateConversationTx(ctx, conversations); err != nil { return nil, err } - for _, userID := range req.UserIDs { - c.conversationNotificationSender.ConversationSetPrivateNotification(ctx, userID, req.Conversation.UserID, req.Conversation.IsPrivateChat.Value, req.Conversation.ConversationID) + if len(req.UserIDs) != 1 || unequal > 0 { + for _, userID := range req.UserIDs { + c.conversationNotificationSender.ConversationSetPrivateNotification(ctx, userID, req.Conversation.UserID, req.Conversation.IsPrivateChat.Value, req.Conversation.ConversationID) + } } } - if req.Conversation.BurnDuration != nil && req.Conversation.BurnDuration.Value != conv.BurnDuration { + if req.Conversation.BurnDuration != nil { m["burn_duration"] = req.Conversation.BurnDuration.Value - } - if len(m) > 0 { - if err := c.conversationDatabase.SetUsersConversationFiledTx(ctx, req.UserIDs, &conversation, m); err != nil { - return nil, err + if req.Conversation.BurnDuration.Value != conv.BurnDuration { + unequal++ } + } + if err := c.conversationDatabase.SetUsersConversationFiledTx(ctx, req.UserIDs, &conversation, m); err != nil { + return nil, err + } + if len(req.UserIDs) != 1 || unequal > 0 { for _, v := range req.UserIDs { c.conversationNotificationSender.ConversationChangeNotification(ctx, v, []string{req.Conversation.ConversationID}) } From a5455c38561673ea79e5491ae9c52c427899d75d Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Fri, 1 Sep 2023 17:21:47 +0800 Subject: [PATCH 07/10] fix: repeated modification session notification --- internal/rpc/conversation/conversaion.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/rpc/conversation/conversaion.go b/internal/rpc/conversation/conversaion.go index 3d34e7345..093bddc35 100644 --- a/internal/rpc/conversation/conversaion.go +++ b/internal/rpc/conversation/conversaion.go @@ -136,7 +136,7 @@ func (c *conversationServer) SetConversations(ctx context.Context, req *pbconver var unequal int var conv tablerelation.ConversationModel if len(req.UserIDs) == 1 { - cs, err := c.conversationDatabase.FindConversations(ctx, req.Conversation.UserID, []string{req.Conversation.ConversationID}) + cs, err := c.conversationDatabase.FindConversations(ctx, req.UserIDs[0], []string{req.Conversation.ConversationID}) if err != nil { return nil, err } From 4a0e949569daa662591a1e6400953ce61affd45e Mon Sep 17 00:00:00 2001 From: withchao <48119764+withchao@users.noreply.github.com> Date: Fri, 1 Sep 2023 17:35:35 +0800 Subject: [PATCH 08/10] fix: repeated modification session notification (#994) * fix: repeated modification session notification * fix: repeated modification session notification --- internal/rpc/conversation/conversaion.go | 74 +++++++++++++++++------- 1 file changed, 52 insertions(+), 22 deletions(-) diff --git a/internal/rpc/conversation/conversaion.go b/internal/rpc/conversation/conversaion.go index d1f4a7fc6..093bddc35 100644 --- a/internal/rpc/conversation/conversaion.go +++ b/internal/rpc/conversation/conversaion.go @@ -133,42 +133,67 @@ func (c *conversationServer) SetConversations(ctx context.Context, req *pbconver // } // } } - cs, err := c.conversationDatabase.FindConversations(ctx, req.Conversation.UserID, []string{req.Conversation.ConversationID}) - if err != nil { - return nil, err - } - if len(cs) == 0 { - return nil, errs.ErrRecordNotFound.Wrap("conversation not found") + var unequal int + var conv tablerelation.ConversationModel + if len(req.UserIDs) == 1 { + cs, err := c.conversationDatabase.FindConversations(ctx, req.UserIDs[0], []string{req.Conversation.ConversationID}) + if err != nil { + return nil, err + } + if len(cs) == 0 { + return nil, errs.ErrRecordNotFound.Wrap("conversation not found") + } + conv = *cs[0] } - conv := cs[0] var conversation tablerelation.ConversationModel conversation.ConversationID = req.Conversation.ConversationID conversation.ConversationType = req.Conversation.ConversationType conversation.UserID = req.Conversation.UserID conversation.GroupID = req.Conversation.GroupID m := make(map[string]interface{}) - if req.Conversation.RecvMsgOpt != nil && req.Conversation.RecvMsgOpt.Value != conv.RecvMsgOpt { + if req.Conversation.RecvMsgOpt != nil { m["recv_msg_opt"] = req.Conversation.RecvMsgOpt.Value + if req.Conversation.RecvMsgOpt.Value != conv.RecvMsgOpt { + unequal++ + } } - if req.Conversation.AttachedInfo != nil && req.Conversation.AttachedInfo.Value != conv.AttachedInfo { + if req.Conversation.AttachedInfo != nil { m["attached_info"] = req.Conversation.AttachedInfo.Value + if req.Conversation.AttachedInfo.Value != conv.AttachedInfo { + unequal++ + } } - if req.Conversation.Ex != nil && req.Conversation.Ex.Value != conv.Ex { + if req.Conversation.Ex != nil { m["ex"] = req.Conversation.Ex.Value + if req.Conversation.Ex.Value != conv.Ex { + unequal++ + } } - if req.Conversation.IsPinned != nil && req.Conversation.IsPinned.Value != conv.IsPinned { + if req.Conversation.IsPinned != nil { m["is_pinned"] = req.Conversation.IsPinned.Value + if req.Conversation.IsPinned.Value != conv.IsPinned { + unequal++ + } } - if req.Conversation.GroupAtType != nil && req.Conversation.GroupAtType.Value != conv.GroupAtType { + if req.Conversation.GroupAtType != nil { m["group_at_type"] = req.Conversation.GroupAtType.Value + if req.Conversation.GroupAtType.Value != conv.GroupAtType { + unequal++ + } } - if req.Conversation.MsgDestructTime != nil && req.Conversation.MsgDestructTime.Value != conv.MsgDestructTime { + if req.Conversation.MsgDestructTime != nil { m["msg_destruct_time"] = req.Conversation.MsgDestructTime.Value + if req.Conversation.MsgDestructTime.Value != conv.MsgDestructTime { + unequal++ + } } - if req.Conversation.IsMsgDestruct != nil && req.Conversation.IsMsgDestruct.Value != conv.IsMsgDestruct { + if req.Conversation.IsMsgDestruct != nil { m["is_msg_destruct"] = req.Conversation.IsMsgDestruct.Value + if req.Conversation.IsMsgDestruct.Value != conv.IsMsgDestruct { + unequal++ + } } - if req.Conversation.IsPrivateChat != nil && req.Conversation.ConversationType != constant.SuperGroupChatType && len(m) > 0 { + if req.Conversation.IsPrivateChat != nil && req.Conversation.ConversationType != constant.SuperGroupChatType { var conversations []*tablerelation.ConversationModel for _, ownerUserID := range req.UserIDs { conversation2 := conversation @@ -179,17 +204,22 @@ func (c *conversationServer) SetConversations(ctx context.Context, req *pbconver if err := c.conversationDatabase.SyncPeerUserPrivateConversationTx(ctx, conversations); err != nil { return nil, err } - for _, userID := range req.UserIDs { - c.conversationNotificationSender.ConversationSetPrivateNotification(ctx, userID, req.Conversation.UserID, req.Conversation.IsPrivateChat.Value, req.Conversation.ConversationID) + if len(req.UserIDs) != 1 || unequal > 0 { + for _, userID := range req.UserIDs { + c.conversationNotificationSender.ConversationSetPrivateNotification(ctx, userID, req.Conversation.UserID, req.Conversation.IsPrivateChat.Value, req.Conversation.ConversationID) + } } } - if req.Conversation.BurnDuration != nil && req.Conversation.BurnDuration.Value != conv.BurnDuration { + if req.Conversation.BurnDuration != nil { m["burn_duration"] = req.Conversation.BurnDuration.Value - } - if len(m) > 0 { - if err := c.conversationDatabase.SetUsersConversationFiledTx(ctx, req.UserIDs, &conversation, m); err != nil { - return nil, err + if req.Conversation.BurnDuration.Value != conv.BurnDuration { + unequal++ } + } + if err := c.conversationDatabase.SetUsersConversationFiledTx(ctx, req.UserIDs, &conversation, m); err != nil { + return nil, err + } + if len(req.UserIDs) != 1 || unequal > 0 { for _, v := range req.UserIDs { c.conversationNotificationSender.ConversationChangeNotification(ctx, v, []string{req.Conversation.ConversationID}) } From f2977b6837ec671203388aee44baf9edcbf2c02e Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Fri, 1 Sep 2023 21:58:23 +0800 Subject: [PATCH 09/10] fix: limit group chat has read message. --- pkg/rpcclient/msg.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/rpcclient/msg.go b/pkg/rpcclient/msg.go index 09e198de4..54577b679 100644 --- a/pkg/rpcclient/msg.go +++ b/pkg/rpcclient/msg.go @@ -250,7 +250,11 @@ func (s *NotificationSender) NotificationWithSesstionType(ctx context.Context, s } msg.CreateTime = utils.GetCurrentTimestampByMill() msg.ClientMsgID = utils.GetMsgID(sendID) - options := config.GetOptionsByNotification(s.contentTypeConf[contentType]) + optionsConfig := s.contentTypeConf[contentType] + if sesstionType == constant.SuperGroupChatType && contentType == constant.HasReadReceipt { + optionsConfig.ReliabilityLevel = constant.UnreliableNotification + } + options := config.GetOptionsByNotification(optionsConfig) msg.Options = options offlineInfo.Title = title offlineInfo.Desc = desc From 123f08191ab30edf622cf9c60a0957dc18991cf5 Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Mon, 4 Sep 2023 19:30:37 +0800 Subject: [PATCH 10/10] fix: jpush return a nil pointer panic --- internal/push/push_to_client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/push/push_to_client.go b/internal/push/push_to_client.go index 50010ca84..de0ecc192 100644 --- a/internal/push/push_to_client.go +++ b/internal/push/push_to_client.go @@ -288,7 +288,7 @@ func (p *Pusher) offlinePushMsg(ctx context.Context, conversationID string, msg } func (p *Pusher) GetOfflinePushOpts(msg *sdkws.MsgData) (opts *offlinepush.Opts, err error) { - opts = &offlinepush.Opts{} + opts = &offlinepush.Opts{Signal: &offlinepush.Signal{}} // if msg.ContentType > constant.SignalingNotificationBegin && msg.ContentType < constant.SignalingNotificationEnd { // req := &sdkws.SignalReq{} // if err := proto.Unmarshal(msg.Content, req); err != nil {