Skip to content

Commit

Permalink
_
Browse files Browse the repository at this point in the history
  • Loading branch information
rasom committed Sep 30, 2021
1 parent 5eba6a4 commit 470c1a4
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/status_im/chat/models.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

(defn active-chat? [cofx chat-id]
(let [chat (get-chat cofx chat-id)]
(not (:active chat))))
(not (nil? chat))))

(defn foreground-chat?
[{{:keys [current-chat-id view-id]} :db} chat-id]
Expand Down Expand Up @@ -138,11 +138,14 @@
{:db (-> db
(assoc-in [:messages chat-id] {})
(update-in [:message-lists] dissoc chat-id)
(update-in [:chats chat-id] merge
{:last-message nil
:unviewed-messages-count 0
:unviewed-mentions-count 0
:deleted-at-clock-value last-message-clock-value}))}))
(update :chats (fn [chats]
(if (contains? chats chat-id)
(update chats chat-id merge
{:last-message nil
:unviewed-messages-count 0
:unviewed-mentions-count 0
:deleted-at-clock-value last-message-clock-value})
chats))))}))

(fx/defn clear-history-handler
"Clears history of the particular chat"
Expand All @@ -162,7 +165,7 @@
(fx/merge
cofx
{:db (-> db
(assoc-in [:chats chat-id :is-active] false)
(dissoc :chats chat-id)
(update :chats-home-list disj chat-id)
(assoc-in [:current-chat-id] nil))
::json-rpc/call [{:method "wakuext_deactivateChat"
Expand Down

0 comments on commit 470c1a4

Please sign in to comment.