Fix semantics of request-contacts-by-address

This commit is contained in:
Eric Dvorsak 2017-10-25 12:34:34 +02:00 committed by Roman Volosovskyi
parent bf71df17b5
commit bdf962a140
1 changed files with 4 additions and 4 deletions

View File

@ -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)