fix incorrect unread counter is displayed when a message is removed (#19217)
This commit is contained in:
parent
463e8a5eec
commit
ef5153f138
|
@ -4,7 +4,6 @@
|
|||
[legacy.status-im.chat.models.loading :as chat.loading]
|
||||
[legacy.status-im.data-store.messages :as data-store.messages]
|
||||
[legacy.status-im.utils.deprecated-types :as types]
|
||||
[re-frame.core :as re-frame]
|
||||
[react-native.platform :as platform]
|
||||
[status-im.contexts.chat.messenger.messages.delete-message.events :as delete-message]
|
||||
[status-im.contexts.chat.messenger.messages.list.events :as message-list]
|
||||
|
@ -135,9 +134,7 @@
|
|||
message-id (:messageId removed-message)]
|
||||
(data-store.messages/mark-messages-seen chat-id
|
||||
[message-id]
|
||||
#(re-frame/dispatch
|
||||
[:chat/decrease-unviewed-count
|
||||
chat-id %3]))))
|
||||
nil)))
|
||||
removed-messages)
|
||||
remove-messages-fx (fn [{:keys [db]}]
|
||||
{:dispatch [:activity-center.notifications/fetch-unread-count]})]
|
||||
|
|
|
@ -243,18 +243,6 @@
|
|||
(update :chats-home-list conj chat-id))
|
||||
:dispatch [:chat/pop-to-root-and-navigate-to-chat chat-id]}))
|
||||
|
||||
(rf/defn decrease-unviewed-count
|
||||
{:events [:chat/decrease-unviewed-count]}
|
||||
[{:keys [db]} chat-id {:keys [count countWithMentions]}]
|
||||
{:db (-> db
|
||||
;; There might be some other requests being fired, so we need to make sure the count has
|
||||
;; not been set to
|
||||
;; 0 in the meantime
|
||||
(update-in [:chats chat-id :unviewed-messages-count]
|
||||
#(max (- % count) 0))
|
||||
(update-in [:chats chat-id :unviewed-mentions-count]
|
||||
#(max (- % countWithMentions) 0)))})
|
||||
|
||||
(rf/defn start-chat
|
||||
"Start a chat, making sure it exists"
|
||||
{:events [:chat.ui/start-chat]}
|
||||
|
|
Loading…
Reference in New Issue