diff --git a/src/status_im2/subs/shell.cljs b/src/status_im2/subs/shell.cljs index dd26f28af4..9a40dcb8b3 100644 --- a/src/status_im2/subs/shell.cljs +++ b/src/status_im2/subs/shell.cljs @@ -231,10 +231,18 @@ (update-in [:community-stack :unviewed-mentions-count] + unviewed-mentions-count)) (and (not muted) - (#{constants/private-group-chat-type constants/one-to-one-chat-type} chat-type)) + (= chat-type constants/private-group-chat-type)) (-> acc (update-in [:chats-stack :unviewed-messages-count] + unviewed-messages-count) (update-in [:chats-stack :unviewed-mentions-count] + unviewed-mentions-count)) + + (and (not muted) + (= chat-type constants/one-to-one-chat-type)) + ;; Note - for 1-1 chats, all unread messages are counted as mentions and shown with counter + (-> acc + (update-in [:chats-stack :unviewed-messages-count] + unviewed-messages-count) + (update-in [:chats-stack :unviewed-mentions-count] + unviewed-messages-count)) + :else acc)) {:chats-stack {:unviewed-messages-count 0 :unviewed-mentions-count 0} @@ -248,8 +256,10 @@ :counter-label (:unviewed-mentions-count community-stack)} :chats-stack {:new-notifications? (pos? (:unviewed-messages-count chats-stack)) - :notification-indicator :counter - :counter-label (:unviewed-messages-count chats-stack)}}))) + :notification-indicator (if (pos? (:unviewed-mentions-count chats-stack)) + :counter + :unread-dot) + :counter-label (:unviewed-mentions-count chats-stack)}}))) ;; Floating screens (re-frame/reg-sub diff --git a/src/status_im2/subs/shell_test.cljs b/src/status_im2/subs/shell_test.cljs index c1394cdf03..971e726f04 100644 --- a/src/status_im2/subs/shell_test.cljs +++ b/src/status_im2/subs/shell_test.cljs @@ -5,17 +5,10 @@ [cljs.test :refer [is testing]] [status-im2.constants :as constants])) -(def expected-notification-data-for-public-profile-timeline-chats - {:communities-stack {:new-notifications? false - :notification-indicator :unread-dot - :counter-label 0} - :chats-stack {:new-notifications? false - :notification-indicator :unread-dot - :counter-label 0}}) - +;; Note - for 1-1 chats, all unread messages are counted as mentions and shown with counter (def one-to-one-group-community-chats1 {"0xone-to-one-chat1" {:chat-type constants/one-to-one-chat-type - :unviewed-messages-count 5 + :unviewed-messages-count 0 :unviewed-mentions-count 0} "0xgroup-chat1" {:chat-type constants/private-group-chat-type :unviewed-messages-count 2 @@ -29,8 +22,8 @@ :notification-indicator :unread-dot :counter-label 0} :chats-stack {:new-notifications? true - :notification-indicator :counter - :counter-label 7}}) + :notification-indicator :unread-dot + :counter-label 0}}) (def one-to-one-group-community-chats2 (merge @@ -51,7 +44,7 @@ :counter-label 7} :chats-stack {:new-notifications? true :notification-indicator :counter - :counter-label 19}}) + :counter-label 11}}) (h/deftest-sub :shell/bottom-tabs-notifications-data [sub-name]