mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-14 02:35:54 +00:00
Fix serialization of group-chats
Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
This commit is contained in:
parent
da7a69bc02
commit
79ab816497
@ -49,13 +49,17 @@
|
|||||||
(->> updates
|
(->> updates
|
||||||
(group-by :signature)
|
(group-by :signature)
|
||||||
(map (fn [[signature events]]
|
(map (fn [[signature events]]
|
||||||
{:events (map #(-> %
|
{:events
|
||||||
(assoc :clock-value (:clockValue %))
|
(into []
|
||||||
(dissoc :signature :from :id :clockValue)
|
(sort-by :clock-value (map #(-> %
|
||||||
remove-empty-vals) events)
|
(assoc :clock-value (:clockValue %))
|
||||||
|
(update :members (fn [members] (into #{} members)))
|
||||||
|
(dissoc :signature :from :id :clockValue)
|
||||||
|
remove-empty-vals) events)))
|
||||||
:from (-> events first :from)
|
:from (-> events first :from)
|
||||||
:signature signature
|
:signature signature
|
||||||
:chat-id chat-id}))))
|
:chat-id chat-id}))
|
||||||
|
(into #{})))
|
||||||
|
|
||||||
(defn type->rpc [{:keys [public? group-chat] :as chat}]
|
(defn type->rpc [{:keys [public? group-chat] :as chat}]
|
||||||
(assoc chat :chatType (cond
|
(assoc chat :chatType (cond
|
||||||
|
@ -121,15 +121,15 @@
|
|||||||
:admins #{"a" "b"}
|
:admins #{"a" "b"}
|
||||||
:members-joined #{"a" "c"}
|
:members-joined #{"a" "c"}
|
||||||
:name "name"
|
:name "name"
|
||||||
:membership-updates [{:chat-id "chat-id"
|
:membership-updates #{{:chat-id "chat-id"
|
||||||
:from "a"
|
:from "a"
|
||||||
:signature "b"
|
:signature "b"
|
||||||
:events [{:type "chat-created"
|
:events [{:type "chat-created"
|
||||||
:name "test"
|
:name "test"
|
||||||
:clock-value 1}
|
:clock-value 1}
|
||||||
{:type "members-added"
|
{:type "members-added"
|
||||||
:clock-value 2
|
:clock-value 2
|
||||||
:members ["a" "b"]}]}]
|
:members #{"a" "b"}}]}}
|
||||||
:unviewed-messages-count 2
|
:unviewed-messages-count 2
|
||||||
:is-active true
|
:is-active true
|
||||||
:group-chat-local-version 1
|
:group-chat-local-version 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user