[FIX: #2262]: DApp description for default contacts (partial fix)

Adds description to default contacts load. Partial fix in the sense that
overwriting contacts don't work yet. Add description key to v16 migration.
This commit is contained in:
Oskar Thorén 2017-10-21 15:49:28 +02:00 committed by Roman Volosovskyi
parent 29030db2b6
commit ec2d3a77a7
3 changed files with 9 additions and 2 deletions

View File

@ -13,6 +13,7 @@
:mixable? {:type :bool :default false}
:status {:type :string :optional true}
:fcm-token {:type :string :optional true}
:description {:type :string :optional true}
:public-key {:type :string
:optional true}
:private-key {:type :string

View File

@ -23,6 +23,7 @@
(spec/def :contact/photo-path (spec/nilable string?))
(spec/def :contact/status (spec/nilable string?))
(spec/def :contact/fcm-token (spec/nilable string?))
(spec/def :contact/description (spec/nilable string?))
(spec/def :contact/last-updated (spec/nilable int?))
(spec/def :contact/last-online (spec/nilable int?))
@ -67,7 +68,8 @@
:contact/responses
:contact/debug?
:contact/subscriptions
:contact/fcm-token]))
:contact/fcm-token
:contact/description]))
;;Contact list ui props
(spec/def :contact-list-ui/edit? boolean?)

View File

@ -211,9 +211,12 @@
:timestamp (random/timestamp)
:contacts (mapv #(hash-map :identity %) contacts)})]])
;; TODO(oskarth): Consider getting rid of the :when so we can overwrite default
;; contacts with default_contacts.json This requires changing semantics of
;; update-pending-status (from :add-contacts handler) too.
(defn- prepare-default-contacts-events [contacts default-contacts]
[[:add-contacts
(for [[id {:keys [name photo-path public-key add-chat? pending?
(for [[id {:keys [name photo-path public-key add-chat? pending? description
dapp? dapp-url dapp-hash bot-url unremovable? mixable?]}] default-contacts
:let [id' (clojure.core/name id)]
:when (not (get contacts id'))]
@ -228,6 +231,7 @@
:dapp? dapp?
:dapp-url (:en dapp-url)
:bot-url bot-url
:description description
:dapp-hash dapp-hash})]])
(defn- prepare-add-chat-events [contacts default-contacts]