From 5547fd65badb967ca34266222bd8024258de2c12 Mon Sep 17 00:00:00 2001 From: alwx Date: Wed, 21 Dec 2016 17:55:48 +0300 Subject: [PATCH] Fix for Add to contacts request (#570) --- src/status_im/chat/handlers.cljs | 5 ----- src/status_im/protocol/handlers.cljs | 26 +++++++++++++------------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/status_im/chat/handlers.cljs b/src/status_im/chat/handlers.cljs index be0d127060..f1dbb2d9d0 100644 --- a/src/status_im/chat/handlers.cljs +++ b/src/status_im/chat/handlers.cljs @@ -456,11 +456,6 @@ (dispatch [::start-chat! contact-id options navigation-type])))))) (register-handler :add-chat - (u/side-effect! - (fn [_ [_ chat-id chat]] - (dispatch [::add-chat chat-id chat])))) - -(register-handler ::add-chat (-> add-new-chat ((enrich add-chat)) ((after save-new-chat!)))) diff --git a/src/status_im/protocol/handlers.cljs b/src/status_im/protocol/handlers.cljs index 6377591b3e..9407dee991 100644 --- a/src/status_im/protocol/handlers.cljs +++ b/src/status_im/protocol/handlers.cljs @@ -385,19 +385,19 @@ (let [{{:keys [name profile-image address status]} :contact {:keys [public private]} :keypair} payload - contact {:whisper-identity from - :public-key public - :private-key private - :address address - :status status - :photo-path profile-image - :name name} - contact-exist? (get contacts from) - chat {:name name - :chat-id from - :contact-info (prn-str contact) - :pending-contact? true}] - (if contact-exist? + contact {:whisper-identity from + :public-key public + :private-key private + :address address + :status status + :photo-path profile-image + :name name} + contact-exists? (get contacts from) + chat {:name name + :chat-id from + :contact-info (prn-str contact) + :pending-contact? true}] + (if contact-exists? (do (dispatch [:update-contact! contact]) (dispatch [:watch-contact contact]))