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)))))))) (dispatch (on-contacts-event-creator (add-identity contacts-by-hash contacts))))))))
(reg-fx (reg-fx
::request-contacts-by-address ::request-contact-by-address
(fn [id] (fn [id]
(http-post "get-contacts-by-address" {:addresses [id]} (http-post "get-contacts-by-address" {:addresses [id]}
(fn [{:keys [contacts]}] (fn [{:keys [contacts]}]
(if (> (count contacts) 0) (if-let [contact (first contacts)]
(let [{:keys [whisper-identity]} (first contacts) (let [{:keys [whisper-identity]} contact
contact {:name (generate-gfy whisper-identity) contact {:name (generate-gfy whisper-identity)
:address id :address id
:photo-path (identicon whisper-identity) :photo-path (identicon whisper-identity)
@ -431,7 +431,7 @@
:add-contact-handler :add-contact-handler
(fn [{:keys [db]} [_ id]] (fn [{:keys [db]} [_ id]]
(if (spec/valid? :global/address 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]) {:dispatch (if (get-in db [:contacts/contacts id])
[:add-pending-contact id] [:add-pending-contact id]
[:add-new-contact-and-open-chat {:name (generate-gfy id) [:add-new-contact-and-open-chat {:name (generate-gfy id)