From bdf962a140d19ba8bf25f05ddcc1c28560155cb8 Mon Sep 17 00:00:00 2001 From: Eric Dvorsak Date: Wed, 25 Oct 2017 12:34:34 +0200 Subject: [PATCH] Fix semantics of request-contacts-by-address --- src/status_im/ui/screens/contacts/events.cljs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/status_im/ui/screens/contacts/events.cljs b/src/status_im/ui/screens/contacts/events.cljs index cfb9288a9b..8757d03aea 100644 --- a/src/status_im/ui/screens/contacts/events.cljs +++ b/src/status_im/ui/screens/contacts/events.cljs @@ -139,12 +139,12 @@ (dispatch (on-contacts-event-creator (add-identity contacts-by-hash contacts)))))))) (reg-fx - ::request-contacts-by-address + ::request-contact-by-address (fn [id] (http-post "get-contacts-by-address" {:addresses [id]} (fn [{:keys [contacts]}] - (if (> (count contacts) 0) - (let [{:keys [whisper-identity]} (first contacts) + (if-let [contact (first contacts)] + (let [{:keys [whisper-identity]} contact contact {:name (generate-gfy whisper-identity) :address id :photo-path (identicon whisper-identity) @@ -431,7 +431,7 @@ :add-contact-handler (fn [{:keys [db]} [_ id]] (if (spec/valid? :global/address id) - {::request-contacts-by-address id} + {::request-contact-by-address id} {:dispatch (if (get-in db [:contacts/contacts id]) [:add-pending-contact id] [:add-new-contact-and-open-chat {:name (generate-gfy id)