Merge pull request #574 from status-im/bug/#559

:update-contact! handler fixed (#559)
This commit is contained in:
Roman Volosovskyi 2016-12-22 15:36:13 +02:00 committed by GitHub
commit 3eb51591d0
1 changed files with 5 additions and 2 deletions

View File

@ -83,9 +83,12 @@
:private updates-private-key}}}}))) :private updates-private-key}}}})))
(register-handler :update-contact! (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)) (update-in db [:contacts whisper-identity] merge contact))
((after save-contact)))) db)))
(defn load-contacts! [db _] (defn load-contacts! [db _]
(let [contacts (->> (contacts/get-all) (let [contacts (->> (contacts/get-all)