mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-08 21:47:17 +08:00
fix: api send messages for notification conversation .
This commit is contained in:
parent
5f8b2790d2
commit
75fea75422
@ -147,7 +147,6 @@ func (m *msgServer) MarkConversationAsRead(
|
|||||||
for i := hasReadSeq + 1; i <= req.HasReadSeq; i++ {
|
for i := hasReadSeq + 1; i <= req.HasReadSeq; i++ {
|
||||||
seqs = append(seqs, i)
|
seqs = append(seqs, i)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(seqs) > 0 {
|
if len(seqs) > 0 {
|
||||||
log.ZDebug(ctx, "MarkConversationAsRead", "seqs", seqs, "conversationID", req.ConversationID)
|
log.ZDebug(ctx, "MarkConversationAsRead", "seqs", seqs, "conversationID", req.ConversationID)
|
||||||
if err = m.MsgDatabase.MarkSingleChatMsgsAsRead(ctx, req.UserID, req.ConversationID, seqs); err != nil {
|
if err = m.MsgDatabase.MarkSingleChatMsgsAsRead(ctx, req.UserID, req.ConversationID, seqs); err != nil {
|
||||||
@ -166,7 +165,8 @@ func (m *msgServer) MarkConversationAsRead(
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if conversation.ConversationType == constant.SuperGroupChatType {
|
} else if conversation.ConversationType == constant.SuperGroupChatType ||
|
||||||
|
conversation.ConversationType == constant.NotificationChatType {
|
||||||
if req.HasReadSeq > hasReadSeq {
|
if req.HasReadSeq > hasReadSeq {
|
||||||
err = m.MsgDatabase.SetHasReadSeq(ctx, req.UserID, req.ConversationID, req.HasReadSeq)
|
err = m.MsgDatabase.SetHasReadSeq(ctx, req.UserID, req.ConversationID, req.HasReadSeq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -215,11 +215,13 @@ func WithRpcGetUserName() NotificationOptions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *NotificationSender) NotificationWithSesstionType(ctx context.Context, sendID, recvID string, contentType, sesstionType int32, m proto.Message, opts ...NotificationOptions) (err error) {
|
func (s *NotificationSender) NotificationWithSesstionType(ctx context.Context, sendID, recvID string,
|
||||||
|
contentType, sesstionType int32, m proto.Message, opts ...NotificationOptions) (err error) {
|
||||||
n := sdkws.NotificationElem{Detail: utils.StructToJsonString(m)}
|
n := sdkws.NotificationElem{Detail: utils.StructToJsonString(m)}
|
||||||
content, err := json.Marshal(&n)
|
content, err := json.Marshal(&n)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.ZError(ctx, "MsgClient Notification json.Marshal failed", err, "sendID", sendID, "recvID", recvID, "contentType", contentType, "msg", m)
|
log.ZError(ctx, "MsgClient Notification json.Marshal failed", err, "sendID",
|
||||||
|
sendID, "recvID", recvID, "contentType", contentType, "msg", m)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
notificationOpt := ¬ificationOpt{}
|
notificationOpt := ¬ificationOpt{}
|
||||||
@ -251,7 +253,7 @@ func (s *NotificationSender) NotificationWithSesstionType(ctx context.Context, s
|
|||||||
msg.CreateTime = utils.GetCurrentTimestampByMill()
|
msg.CreateTime = utils.GetCurrentTimestampByMill()
|
||||||
msg.ClientMsgID = utils.GetMsgID(sendID)
|
msg.ClientMsgID = utils.GetMsgID(sendID)
|
||||||
optionsConfig := s.contentTypeConf[contentType]
|
optionsConfig := s.contentTypeConf[contentType]
|
||||||
if sesstionType == constant.SuperGroupChatType && contentType == constant.HasReadReceipt {
|
if sendID == recvID && contentType == constant.HasReadReceipt {
|
||||||
optionsConfig.ReliabilityLevel = constant.UnreliableNotification
|
optionsConfig.ReliabilityLevel = constant.UnreliableNotification
|
||||||
}
|
}
|
||||||
options := config.GetOptionsByNotification(optionsConfig)
|
options := config.GetOptionsByNotification(optionsConfig)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user