Andrey Shovkoplyas 2017-03-26 11:58:37 +03:00 committed by Roman Volosovskyi
parent 1b6112a9bd
commit b8a491e66d
2 changed files with 3 additions and 5 deletions

View File

@ -42,9 +42,7 @@
(defn- save-contacts (defn- save-contacts
[identities contacts] [identities contacts]
(doseq [contact-identity identities] (doseq [contact-identity identities]
(if-let [contact (.find contacts (fn [object _ _] (.push contacts (clj->js {:identity contact-identity}))))
(= contact-identity (aget object "identity"))))]
(.push contacts (clj->js {:identity contact-identity})))))
(defn add-contacts (defn add-contacts
[group-id identities] [group-id identities]

View File

@ -284,7 +284,7 @@
(fn [db [_ new-groups]] (fn [db [_ new-groups]]
(-> db (-> db
(update :contact-groups merge (map #(vector (:group-id %) %) new-groups)) (update :contact-groups merge (map #(vector (:group-id %) %) new-groups))
(assoc db :new-groups new-groups)))) (assoc :new-groups new-groups))))
(register-handler :save-group-order (register-handler :save-group-order
(u/side-effect! (u/side-effect!
@ -317,7 +317,7 @@
(defn add-selected-contacts-to-group (defn add-selected-contacts-to-group
[{:keys [selected-contacts contact-groups contact-group-id] :as db} _] [{:keys [selected-contacts contact-groups contact-group-id] :as db} _]
(let [new-identities (mapv #(hash-map :identity %) selected-contacts)] (let [new-identities (mapv #(hash-map :identity %) selected-contacts)]
(update db [:contact-groups contact-group-id :contacts] concat new-identities))) (update-in db [:contact-groups contact-group-id :contacts] concat new-identities)))
(defn add-selected-contacts-to-group! (defn add-selected-contacts-to-group!
[{:keys [contact-group-id selected-contacts]} _] [{:keys [contact-group-id selected-contacts]} _]