[fix 4574] do not send updates to pending contacts

fixes #4574

updates were sent to all pending contacts
fixes that by filtering on the pending? key
This commit is contained in:
Eric Dvorsak 2018-06-01 00:47:45 +02:00 committed by Roman Volosovskyi
parent 65fa9e5741
commit 8782ecc06d
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
1 changed files with 7 additions and 1 deletions

View File

@ -68,7 +68,13 @@
(defrecord ContactUpdate [name profile-image]
message/StatusMessage
(send [this _ {:keys [db] :as cofx}]
(let [public-keys (into #{} (remove nil? (map :public-key (vals (:contacts/contacts db)))))
(let [public-keys (reduce (fn [acc [_ {:keys [public-key pending?]}]]
(if (and public-key
(not pending?))
(conj acc public-key)
acc))
#{}
(:contacts/contacts db))
recipients (filter #(public-keys (first %)) (:transport/chats db))]
(handlers-macro/merge-effects
cofx