mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-27 17:06:18 +00:00
[slow sign in] faster get-unviewed-messages
This commit is contained in:
parent
605f8d2590
commit
b792ab5cf3
@ -82,16 +82,16 @@
|
||||
|
||||
(defn- get-unviewed-messages
|
||||
[public-key]
|
||||
(into {}
|
||||
(map (fn [[chat-id user-statuses]]
|
||||
[chat-id (into #{} (map :message-id) user-statuses)]))
|
||||
(group-by :chat-id
|
||||
(-> @core/account-realm
|
||||
(core/get-by-fields
|
||||
:user-status
|
||||
:and {:public-key public-key
|
||||
:status "received"})
|
||||
(core/all-clj :user-status)))))
|
||||
(-> @core/account-realm
|
||||
(core/get-by-fields
|
||||
:user-status
|
||||
:and {:public-key public-key
|
||||
:status "received"})
|
||||
(.reduce (fn [acc msg _ _]
|
||||
(let [chat-id (aget msg "chat-id")
|
||||
message-id (aget msg "message-id")]
|
||||
(update acc chat-id (fnil conj #{}) message-id)))
|
||||
{})))
|
||||
|
||||
(re-frame/reg-cofx
|
||||
:data-store/get-unviewed-messages
|
||||
|
Loading…
x
Reference in New Issue
Block a user