[Fix] Seen state in Activity Center when it is open (#16541)
This commit fixes the seen state of notifications, if the user is in the Activity Center screen while receiving a new notification. Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
This commit is contained in:
parent
3fce4816dc
commit
126a8705cd
|
@ -102,7 +102,10 @@
|
|||
(rf/defn reconcile-seen-state
|
||||
{:events [:activity-center/reconcile-seen-state]}
|
||||
[{:keys [db]} seen?]
|
||||
{:db (assoc-in db [:activity-center :seen?] seen?)})
|
||||
(cond-> {:db (assoc-in db [:activity-center :seen?] seen?)}
|
||||
|
||||
(= (:view-id db) :activity-center)
|
||||
(assoc :dispatch [:activity-center/mark-as-seen])))
|
||||
|
||||
;;;; Status changes (read/dismissed/deleted)
|
||||
|
||||
|
|
|
@ -436,3 +436,19 @@
|
|||
:type types/one-to-one-chat}
|
||||
:cursor ""}}}
|
||||
(events/notifications-fetch-error cofx :dummy-error))))))
|
||||
|
||||
(deftest seen-state-test
|
||||
(testing "update seen state"
|
||||
(is (= {:db {:activity-center {:seen? true}}}
|
||||
(events/reconcile-seen-state {:db {}} true))))
|
||||
|
||||
(testing "update seen state when the user is on other screen"
|
||||
(is (= {:db {:view-id :chats-stack
|
||||
:activity-center {:seen? false}}}
|
||||
(events/reconcile-seen-state {:db {:view-id :chats-stack}} false))))
|
||||
|
||||
(testing "update seen state when the user is on activity center"
|
||||
(is (= {:db {:view-id :activity-center
|
||||
:activity-center {:seen? false}}
|
||||
:dispatch [:activity-center/mark-as-seen]}
|
||||
(events/reconcile-seen-state {:db {:view-id :activity-center}} false)))))
|
||||
|
|
Loading…
Reference in New Issue