From 3ec25d00619a8ace199fbe26aeaf46b9ea89a6c9 Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Tue, 24 Oct 2023 18:37:22 +0800 Subject: [PATCH] fix: api send messages for notification conversation. --- internal/rpc/msg/as_read.go | 4 ++-- pkg/rpcclient/conversation.go | 3 +-- pkg/rpcclient/msg.go | 5 +++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/rpc/msg/as_read.go b/internal/rpc/msg/as_read.go index c31cd02dd..6e3bbe987 100644 --- a/internal/rpc/msg/as_read.go +++ b/internal/rpc/msg/as_read.go @@ -165,8 +165,8 @@ func (m *msgServer) MarkConversationAsRead( m.conversationAndGetRecvID(conversation, req.UserID), seqs, hasReadSeq); err != nil { return nil, err } - - } else if conversation.ConversationType == constant.SuperGroupChatType { + } else if conversation.ConversationType == constant.SuperGroupChatType || + conversation.ConversationType == constant.NotificationChatType { if req.HasReadSeq > hasReadSeq { err = m.MsgDatabase.SetHasReadSeq(ctx, req.UserID, req.ConversationID, req.HasReadSeq) if err != nil { diff --git a/pkg/rpcclient/conversation.go b/pkg/rpcclient/conversation.go index 057e0fd23..3ba8dd8c0 100644 --- a/pkg/rpcclient/conversation.go +++ b/pkg/rpcclient/conversation.go @@ -60,8 +60,7 @@ func (c *ConversationRpcClient) GetSingleConversationRecvMsgOpt(ctx context.Cont } func (c *ConversationRpcClient) SingleChatFirstCreateConversation(ctx context.Context, recvID, sendID, - conversationID string, conversationType int32, -) error { + conversationID string, conversationType int32) error { _, err := c.Client.CreateSingleChatConversations(ctx, &pbconversation.CreateSingleChatConversationsReq{ RecvID: recvID, SendID: sendID, ConversationID: conversationID, diff --git a/pkg/rpcclient/msg.go b/pkg/rpcclient/msg.go index e3dad874e..3b09b5062 100644 --- a/pkg/rpcclient/msg.go +++ b/pkg/rpcclient/msg.go @@ -228,8 +228,9 @@ func (s *NotificationSender) NotificationWithSesstionType(ctx context.Context, s } var req msg.SendMsgReq var msg sdkws.MsgData + var userInfo *sdkws.UserInfo if notificationOpt.WithRpcGetUsername && s.getUserInfo != nil { - userInfo, err := s.getUserInfo(ctx, sendID) + userInfo, err = s.getUserInfo(ctx, sendID) if err != nil { log.ZWarn(ctx, "getUserInfo failed", err, "sendID", sendID) } else { @@ -251,7 +252,7 @@ func (s *NotificationSender) NotificationWithSesstionType(ctx context.Context, s msg.CreateTime = utils.GetCurrentTimestampByMill() msg.ClientMsgID = utils.GetMsgID(sendID) optionsConfig := s.contentTypeConf[contentType] - if sesstionType == constant.SuperGroupChatType && contentType == constant.HasReadReceipt { + if sendID == recvID && contentType == constant.HasReadReceipt { optionsConfig.ReliabilityLevel = constant.UnreliableNotification } options := config.GetOptionsByNotification(optionsConfig)