[refactor] contact model: remove unused fields and add `blocked?`
- dapp related fields are removed since it is not used anymore - blocked? field is added for futur block user feature
This commit is contained in:
parent
211a531f44
commit
444c6af319
|
@ -18,23 +18,12 @@
|
|||
(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?))
|
||||
(spec/def :contact/pending? boolean?)
|
||||
(spec/def :contact/unremovable? boolean?)
|
||||
(spec/def :contact/hide-contact? boolean?)
|
||||
|
||||
(spec/def :contact/dapp? boolean?)
|
||||
(spec/def :contact/dapp-url (spec/nilable string?))
|
||||
(spec/def :contact/dapp-hash (spec/nilable int?))
|
||||
(spec/def :contact/bot-url (spec/nilable string?))
|
||||
(spec/def :contact/command (spec/nilable (spec/map-of int? map?)))
|
||||
(spec/def :contact/response (spec/nilable (spec/map-of int? map?)))
|
||||
(spec/def :contact/subscriptions (spec/nilable map?))
|
||||
;;true when contact added using status-dev-cli
|
||||
(spec/def :contact/debug? boolean?)
|
||||
(spec/def :contact/tags (spec/coll-of string? :kind set?))
|
||||
(spec/def :contact/blocked? boolean?)
|
||||
|
||||
(spec/def :contact/contact (spec/keys :req-un [:contact/name]
|
||||
:opt-un [:contact/public-key
|
||||
|
@ -45,17 +34,9 @@
|
|||
:contact/last-online
|
||||
:contact/pending?
|
||||
:contact/hide-contact?
|
||||
:contact/unremovable?
|
||||
:contact/dapp?
|
||||
:contact/dapp-url
|
||||
:contact/dapp-hash
|
||||
:contact/bot-url
|
||||
:contact/command
|
||||
:contact/response
|
||||
:contact/debug?
|
||||
:contact/subscriptions
|
||||
:contact/fcm-token
|
||||
:contact/description
|
||||
:contact/blocked?
|
||||
:contact/tags]))
|
||||
|
||||
;;Contact list ui props
|
||||
|
|
|
@ -8,15 +8,6 @@
|
|||
(fn [db]
|
||||
(:contacts/dapps db)))
|
||||
|
||||
(re-frame/reg-sub
|
||||
::all-added-contacts
|
||||
:<- [:contacts/contacts]
|
||||
(fn [contacts]
|
||||
(->> contacts
|
||||
(remove (fn [[_ {:keys [pending? hide-contact?]}]]
|
||||
(or pending? hide-contact?)))
|
||||
(contact.db/sort-contacts))))
|
||||
|
||||
(re-frame/reg-sub
|
||||
::query-current-chat-contacts
|
||||
:<- [:chats/current-chat]
|
||||
|
@ -29,6 +20,15 @@
|
|||
(fn [db]
|
||||
(get db :contacts/contacts)))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:contacts/active
|
||||
:<- [:contacts/contacts]
|
||||
(fn [contacts]
|
||||
(->> contacts
|
||||
(remove (fn [[_ {:keys [pending? hide-contact?]}]]
|
||||
(or pending? hide-contact?)))
|
||||
(contact.db/sort-contacts))))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:contacts/current-contact-identity
|
||||
(fn [db]
|
||||
|
@ -41,12 +41,6 @@
|
|||
(fn [[contacts identity]]
|
||||
(contacts identity)))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:contacts/all-added-people-contacts
|
||||
:<- [::all-added-contacts]
|
||||
(fn [contacts]
|
||||
(remove :dapp? contacts)))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:contacts/all-dapps
|
||||
:<- [::dapps]
|
||||
|
|
|
@ -77,3 +77,19 @@
|
|||
:debug? {:type :bool
|
||||
:default false}
|
||||
:tags {:type "string[]"}}})
|
||||
|
||||
(def v4 {:name :contact
|
||||
:primaryKey :public-key
|
||||
:properties {:address {:type :string :optional true}
|
||||
:name {:type :string :optional true}
|
||||
:photo-path {:type :string :optional true}
|
||||
:last-updated {:type :int :default 0}
|
||||
:last-online {:type :int :default 0}
|
||||
:blocked? {:type :bool :default false}
|
||||
:pending? {:type :bool :default false}
|
||||
:hide-contact? {:type :bool :default false}
|
||||
:status {:type :string :optional true}
|
||||
:fcm-token {:type :string :optional true}
|
||||
:description {:type :string :optional true}
|
||||
:public-key :string
|
||||
:tags {:type "string[]"}}})
|
||||
|
|
|
@ -399,6 +399,20 @@
|
|||
dapp-permissions/v9
|
||||
contact-recovery/v1])
|
||||
|
||||
(def v36 [chat/v14
|
||||
transport/v8
|
||||
contact/v4
|
||||
message/v9
|
||||
mailserver/v11
|
||||
mailserver-topic/v1
|
||||
user-status/v2
|
||||
membership-update/v1
|
||||
installation/v3
|
||||
local-storage/v1
|
||||
browser/v8
|
||||
dapp-permissions/v9
|
||||
contact-recovery/v1])
|
||||
|
||||
;; put schemas ordered by version
|
||||
(def schemas [{:schema v1
|
||||
:schemaVersion 1
|
||||
|
@ -504,4 +518,7 @@
|
|||
:migration migrations/v34}
|
||||
{:schema v35
|
||||
:schemaVersion 35
|
||||
:migration migrations/v35}])
|
||||
:migration migrations/v35}
|
||||
{:schema v36
|
||||
:schemaVersion 36
|
||||
:migration (constantly nil)}])
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
:show-forward? true}])
|
||||
|
||||
(views/defview new-chat []
|
||||
(views/letsubs [contacts [:contacts/all-added-people-contacts]
|
||||
(views/letsubs [contacts [:contacts/active]
|
||||
error-message [:new-identity-error]]
|
||||
[react/keyboard-avoiding-view open-dapp.styles/main-container
|
||||
[status-bar/status-bar]
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
(views/defview new-one-to-one []
|
||||
(views/letsubs [new-contact-identity [:get :contacts/new-identity]
|
||||
contacts [:contacts/all-added-people-contacts]
|
||||
contacts [:contacts/active]
|
||||
chat-error [:new-identity-error]]
|
||||
{:component-will-unmount #(re-frame/dispatch [:new-chat/set-new-identity nil])}
|
||||
[react/view {:style styles/new-view}
|
||||
|
|
|
@ -26,12 +26,12 @@
|
|||
(fn [selected-participants]
|
||||
(count selected-participants)))
|
||||
|
||||
(defn filter-contacts [selected-contacts added-contacts]
|
||||
(filter #(selected-contacts (:public-key %)) added-contacts))
|
||||
(defn filter-contacts [selected-contacts active-contacts]
|
||||
(filter #(selected-contacts (:public-key %)) active-contacts))
|
||||
|
||||
(reg-sub
|
||||
:selected-group-contacts
|
||||
:<- [:get :group/selected-contacts]
|
||||
:<- [:contacts/all-added-people-contacts]
|
||||
(fn [[selected-contacts added-contacts]]
|
||||
(filter-contacts selected-contacts added-contacts)))
|
||||
:<- [:contacts/active]
|
||||
(fn [[selected-contacts active-contacts]]
|
||||
(filter-contacts selected-contacts active-contacts)))
|
||||
|
|
|
@ -121,7 +121,7 @@
|
|||
|
||||
;; Start group chat
|
||||
(views/defview contact-toggle-list []
|
||||
(views/letsubs [contacts [:contacts/all-added-people-contacts]
|
||||
(views/letsubs [contacts [:contacts/active]
|
||||
selected-contacts-count [:selected-contacts-count]]
|
||||
[react/keyboard-avoiding-view {:style styles/group-container}
|
||||
[status-bar/status-bar]
|
||||
|
|
|
@ -211,7 +211,7 @@
|
|||
(ethereum/normalized-address (:address contact))]]]])
|
||||
|
||||
(views/defview recent-recipients []
|
||||
(views/letsubs [contacts [:contacts/all-added-people-contacts]]
|
||||
(views/letsubs [contacts [:contacts/active]]
|
||||
[simple-screen
|
||||
[toolbar (i18n/label :t/recipient)]
|
||||
[react/view styles/recent-recipients
|
||||
|
|
|
@ -18,15 +18,11 @@
|
|||
:address "eca8218b5ebeb2c47ba94c1b6e0a779d78fff7bc",
|
||||
:name "User B",
|
||||
:fcm-token nil,
|
||||
:dapp-url nil,
|
||||
:dapp-hash nil,
|
||||
:photo-path "photo1",
|
||||
:debug? false,
|
||||
:status nil,
|
||||
:bot-url nil,
|
||||
:blocked? false,
|
||||
:pending? true,
|
||||
:last-online 0,
|
||||
:dapp? false,
|
||||
:public-key
|
||||
"0x04985040682b77a32bb4bb58268a0719bd24ca4d07c255153fe1eb2ccd5883669627bd1a092d7cc76e8e4b9104327667b19dcda3ac469f572efabe588c38c1985f"}}
|
||||
current-account {:last-updated 0,
|
||||
|
@ -54,13 +50,9 @@
|
|||
:address "eca8218b5ebeb2c47ba94c1b6e0a779d78fff7bc"
|
||||
:name "User B"
|
||||
:fcm-token nil
|
||||
:dapp-url nil
|
||||
:dapp-hash nil
|
||||
:photo-path "photo1"
|
||||
:debug? false
|
||||
:status nil
|
||||
:bot-url nil
|
||||
:blocked? false
|
||||
:pending? true
|
||||
:last-online 0
|
||||
:dapp? false
|
||||
:public-key "0x04985040682b77a32bb4bb58268a0719bd24ca4d07c255153fe1eb2ccd5883669627bd1a092d7cc76e8e4b9104327667b19dcda3ac469f572efabe588c38c1985f"}]))))))
|
||||
|
|
Loading…
Reference in New Issue