From 1eef4013e2f7561f2a8bd63816e4257638370deb Mon Sep 17 00:00:00 2001 From: OpenIM-Gordon <46924906+FGadvancer@users.noreply.github.com> Date: Mon, 27 May 2024 11:56:46 +0800 Subject: [PATCH] fix: main bug fix notification unread (#2266) * fix: notification has counted unread counts bug fix. * fix: notification has counted unread counts bug fix. --- .../msgtransfer/online_history_msg_handler.go | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/internal/msgtransfer/online_history_msg_handler.go b/internal/msgtransfer/online_history_msg_handler.go index df2660804d..551e3fe911 100644 --- a/internal/msgtransfer/online_history_msg_handler.go +++ b/internal/msgtransfer/online_history_msg_handler.go @@ -176,20 +176,15 @@ func (och *OnlineHistoryRedisConsumerHandler) getPushStorageMsgList( if v.message.Options != nil { msg.Options = msgprocessor.NewMsgOptions() } - if options.IsOfflinePush() { - v.message.Options = msgprocessor.WithOptions( - v.message.Options, - msgprocessor.WithOfflinePush(false), - ) - msg.Options = msgprocessor.WithOptions(msg.Options, msgprocessor.WithOfflinePush(true)) - } - if options.IsUnreadCount() { - v.message.Options = msgprocessor.WithOptions( - v.message.Options, - msgprocessor.WithUnreadCount(false), - ) - msg.Options = msgprocessor.WithOptions(msg.Options, msgprocessor.WithUnreadCount(true)) - } + msg.Options = msgprocessor.WithOptions(msg.Options, + msgprocessor.WithOfflinePush(options.IsOfflinePush()), + msgprocessor.WithUnreadCount(options.IsUnreadCount()), + ) + v.message.Options = msgprocessor.WithOptions( + v.message.Options, + msgprocessor.WithOfflinePush(false), + msgprocessor.WithUnreadCount(false), + ) storageMsgList = append(storageMsgList, msg) } if isStorage(v.message) {