[fix] request the right topic from inbox when adding new key

Signed-off-by: Eric Dvorsak <eric@dvorsak.fr>
This commit is contained in:
Eric Dvorsak 2018-05-14 19:05:36 +02:00
parent 9a94779238
commit 225d2e2ec0
No known key found for this signature in database
GPG Key ID: 932AC1CE5F05DE0C
2 changed files with 11 additions and 8 deletions

View File

@ -69,7 +69,10 @@
;;TODO (yenda) remove once go implements persistence ;;TODO (yenda) remove once go implements persistence
(assoc :sym-key sym-key))] (assoc :sym-key sym-key))]
(handlers-macro/merge-fx cofx (handlers-macro/merge-fx cofx
{:db (assoc-in db [:transport/chats chat-id :sym-key-id] sym-key-id) {:db (assoc-in db
[:transport/chats chat-id :sym-key-id]
sym-key-id)
:dispatch [:inbox/request-messages {:topics [topic]}]
:shh/add-filter {:web3 web3 :shh/add-filter {:web3 web3
:sym-key-id sym-key-id :sym-key-id sym-key-id
:topic topic :topic topic
@ -124,10 +127,14 @@
[re-frame/trim-v (re-frame/inject-cofx :random-id)] [re-frame/trim-v (re-frame/inject-cofx :random-id)]
(fn [{:keys [db] :as cofx} [{:keys [sym-key-id sym-key chat-id signature message]}]] (fn [{:keys [db] :as cofx} [{:keys [sym-key-id sym-key chat-id signature message]}]]
(let [{:keys [web3 current-public-key]} db (let [{:keys [web3 current-public-key]} db
fx {:db (assoc-in db [:transport/chats chat-id :sym-key-id] sym-key-id) topic (transport.utils/get-topic chat-id)
fx {:db (assoc-in db
[:transport/chats chat-id :sym-key-id]
sym-key-id)
:dispatch [:inbox/request-messages {:topics [topic]}]
:shh/add-filter {:web3 web3 :shh/add-filter {:web3 web3
:sym-key-id sym-key-id :sym-key-id sym-key-id
:topic (transport.utils/get-topic chat-id) :topic topic
:chat-id chat-id} :chat-id chat-id}
:data-store/tx [(transport-store/save-transport-tx :data-store/tx [(transport-store/save-transport-tx
{:chat-id chat-id {:chat-id chat-id

View File

@ -43,11 +43,7 @@
:on-success on-success}} :on-success on-success}}
(protocol/init-chat chat-id topic)))) (protocol/init-chat chat-id topic))))
(receive [this chat-id signature {:keys [db] :as cofx}] (receive [this chat-id signature {:keys [db] :as cofx}]
(let [topic (transport.utils/get-topic chat-id)] (contacts/receive-contact-request signature this cofx)))
(handlers-macro/merge-fx cofx
{:dispatch [:inbox/request-messages {:topics [topic]}]}
(contacts/receive-contact-request signature
this)))))
(defrecord ContactRequestConfirmed [name profile-image address fcm-token] (defrecord ContactRequestConfirmed [name profile-image address fcm-token]
message/StatusMessage message/StatusMessage