From 316e321b025fa54cc45024488122b2aa879e6833 Mon Sep 17 00:00:00 2001 From: alwx Date: Thu, 22 Dec 2016 12:35:17 +0300 Subject: [PATCH] :update-contact! handler fixed (#559) --- src/status_im/contacts/handlers.cljs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/status_im/contacts/handlers.cljs b/src/status_im/contacts/handlers.cljs index fbc77c8bb7..718d8dfe0a 100644 --- a/src/status_im/contacts/handlers.cljs +++ b/src/status_im/contacts/handlers.cljs @@ -83,9 +83,12 @@ :private updates-private-key}}}}))) (register-handler :update-contact! - (-> (fn [db [_ {:keys [whisper-identity] :as contact}]] + (fn [db [_ {:keys [whisper-identity] :as contact}]] + (if (contacts/exists? whisper-identity) + (do + (contacts/save contact) (update-in db [:contacts whisper-identity] merge contact)) - ((after save-contact)))) + db))) (defn load-contacts! [db _] (let [contacts (->> (contacts/get-all)