From 225d2e2ec0922fa1428db828b5bf77ff5a405b57 Mon Sep 17 00:00:00 2001 From: Eric Dvorsak Date: Mon, 14 May 2018 19:05:36 +0200 Subject: [PATCH] [fix] request the right topic from inbox when adding new key Signed-off-by: Eric Dvorsak --- src/status_im/transport/handlers.cljs | 13 ++++++++++--- src/status_im/transport/message/v1/contact.cljs | 6 +----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/status_im/transport/handlers.cljs b/src/status_im/transport/handlers.cljs index 54e16cf5b3..28f92f5b1e 100644 --- a/src/status_im/transport/handlers.cljs +++ b/src/status_im/transport/handlers.cljs @@ -69,7 +69,10 @@ ;;TODO (yenda) remove once go implements persistence (assoc :sym-key sym-key))] (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 :sym-key-id sym-key-id :topic topic @@ -124,10 +127,14 @@ [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]}]] (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 :sym-key-id sym-key-id - :topic (transport.utils/get-topic chat-id) + :topic topic :chat-id chat-id} :data-store/tx [(transport-store/save-transport-tx {:chat-id chat-id diff --git a/src/status_im/transport/message/v1/contact.cljs b/src/status_im/transport/message/v1/contact.cljs index 52ea8dbc90..31799979de 100644 --- a/src/status_im/transport/message/v1/contact.cljs +++ b/src/status_im/transport/message/v1/contact.cljs @@ -43,11 +43,7 @@ :on-success on-success}} (protocol/init-chat chat-id topic)))) (receive [this chat-id signature {:keys [db] :as cofx}] - (let [topic (transport.utils/get-topic chat-id)] - (handlers-macro/merge-fx cofx - {:dispatch [:inbox/request-messages {:topics [topic]}]} - (contacts/receive-contact-request signature - this))))) + (contacts/receive-contact-request signature this cofx))) (defrecord ContactRequestConfirmed [name profile-image address fcm-token] message/StatusMessage