mirror of
https://github.com/status-im/status-react.git
synced 2025-02-02 14:14:39 +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
|
(defn- get-unviewed-messages
|
||||||
[public-key]
|
[public-key]
|
||||||
(into {}
|
(-> @core/account-realm
|
||||||
(map (fn [[chat-id user-statuses]]
|
(core/get-by-fields
|
||||||
[chat-id (into #{} (map :message-id) user-statuses)]))
|
:user-status
|
||||||
(group-by :chat-id
|
:and {:public-key public-key
|
||||||
(-> @core/account-realm
|
:status "received"})
|
||||||
(core/get-by-fields
|
(.reduce (fn [acc msg _ _]
|
||||||
:user-status
|
(let [chat-id (aget msg "chat-id")
|
||||||
:and {:public-key public-key
|
message-id (aget msg "message-id")]
|
||||||
:status "received"})
|
(update acc chat-id (fnil conj #{}) message-id)))
|
||||||
(core/all-clj :user-status)))))
|
{})))
|
||||||
|
|
||||||
(re-frame/reg-cofx
|
(re-frame/reg-cofx
|
||||||
:data-store/get-unviewed-messages
|
:data-store/get-unviewed-messages
|
||||||
|
Loading…
x
Reference in New Issue
Block a user