[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/status (spec/nilable string?))
|
||||||
(spec/def :contact/fcm-token (spec/nilable string?))
|
(spec/def :contact/fcm-token (spec/nilable string?))
|
||||||
(spec/def :contact/description (spec/nilable string?))
|
(spec/def :contact/description (spec/nilable string?))
|
||||||
|
|
||||||
(spec/def :contact/last-updated (spec/nilable int?))
|
(spec/def :contact/last-updated (spec/nilable int?))
|
||||||
(spec/def :contact/last-online (spec/nilable int?))
|
(spec/def :contact/last-online (spec/nilable int?))
|
||||||
(spec/def :contact/pending? boolean?)
|
(spec/def :contact/pending? boolean?)
|
||||||
(spec/def :contact/unremovable? boolean?)
|
|
||||||
(spec/def :contact/hide-contact? 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/tags (spec/coll-of string? :kind set?))
|
||||||
|
(spec/def :contact/blocked? boolean?)
|
||||||
|
|
||||||
(spec/def :contact/contact (spec/keys :req-un [:contact/name]
|
(spec/def :contact/contact (spec/keys :req-un [:contact/name]
|
||||||
:opt-un [:contact/public-key
|
:opt-un [:contact/public-key
|
||||||
|
@ -45,17 +34,9 @@
|
||||||
:contact/last-online
|
:contact/last-online
|
||||||
:contact/pending?
|
:contact/pending?
|
||||||
:contact/hide-contact?
|
: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/fcm-token
|
||||||
:contact/description
|
:contact/description
|
||||||
|
:contact/blocked?
|
||||||
:contact/tags]))
|
:contact/tags]))
|
||||||
|
|
||||||
;;Contact list ui props
|
;;Contact list ui props
|
||||||
|
|
|
@ -8,15 +8,6 @@
|
||||||
(fn [db]
|
(fn [db]
|
||||||
(:contacts/dapps 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
|
(re-frame/reg-sub
|
||||||
::query-current-chat-contacts
|
::query-current-chat-contacts
|
||||||
:<- [:chats/current-chat]
|
:<- [:chats/current-chat]
|
||||||
|
@ -29,6 +20,15 @@
|
||||||
(fn [db]
|
(fn [db]
|
||||||
(get db :contacts/contacts)))
|
(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
|
(re-frame/reg-sub
|
||||||
:contacts/current-contact-identity
|
:contacts/current-contact-identity
|
||||||
(fn [db]
|
(fn [db]
|
||||||
|
@ -41,12 +41,6 @@
|
||||||
(fn [[contacts identity]]
|
(fn [[contacts identity]]
|
||||||
(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
|
(re-frame/reg-sub
|
||||||
:contacts/all-dapps
|
:contacts/all-dapps
|
||||||
:<- [::dapps]
|
:<- [::dapps]
|
||||||
|
|
|
@ -77,3 +77,19 @@
|
||||||
:debug? {:type :bool
|
:debug? {:type :bool
|
||||||
:default false}
|
:default false}
|
||||||
:tags {:type "string[]"}}})
|
: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
|
dapp-permissions/v9
|
||||||
contact-recovery/v1])
|
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
|
;; put schemas ordered by version
|
||||||
(def schemas [{:schema v1
|
(def schemas [{:schema v1
|
||||||
:schemaVersion 1
|
:schemaVersion 1
|
||||||
|
@ -504,4 +518,7 @@
|
||||||
:migration migrations/v34}
|
:migration migrations/v34}
|
||||||
{:schema v35
|
{:schema v35
|
||||||
:schemaVersion 35
|
:schemaVersion 35
|
||||||
:migration migrations/v35}])
|
:migration migrations/v35}
|
||||||
|
{:schema v36
|
||||||
|
:schemaVersion 36
|
||||||
|
:migration (constantly nil)}])
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
:show-forward? true}])
|
:show-forward? true}])
|
||||||
|
|
||||||
(views/defview new-chat []
|
(views/defview new-chat []
|
||||||
(views/letsubs [contacts [:contacts/all-added-people-contacts]
|
(views/letsubs [contacts [:contacts/active]
|
||||||
error-message [:new-identity-error]]
|
error-message [:new-identity-error]]
|
||||||
[react/keyboard-avoiding-view open-dapp.styles/main-container
|
[react/keyboard-avoiding-view open-dapp.styles/main-container
|
||||||
[status-bar/status-bar]
|
[status-bar/status-bar]
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
(views/defview new-one-to-one []
|
(views/defview new-one-to-one []
|
||||||
(views/letsubs [new-contact-identity [:get :contacts/new-identity]
|
(views/letsubs [new-contact-identity [:get :contacts/new-identity]
|
||||||
contacts [:contacts/all-added-people-contacts]
|
contacts [:contacts/active]
|
||||||
chat-error [:new-identity-error]]
|
chat-error [:new-identity-error]]
|
||||||
{:component-will-unmount #(re-frame/dispatch [:new-chat/set-new-identity nil])}
|
{:component-will-unmount #(re-frame/dispatch [:new-chat/set-new-identity nil])}
|
||||||
[react/view {:style styles/new-view}
|
[react/view {:style styles/new-view}
|
||||||
|
|
|
@ -26,12 +26,12 @@
|
||||||
(fn [selected-participants]
|
(fn [selected-participants]
|
||||||
(count selected-participants)))
|
(count selected-participants)))
|
||||||
|
|
||||||
(defn filter-contacts [selected-contacts added-contacts]
|
(defn filter-contacts [selected-contacts active-contacts]
|
||||||
(filter #(selected-contacts (:public-key %)) added-contacts))
|
(filter #(selected-contacts (:public-key %)) active-contacts))
|
||||||
|
|
||||||
(reg-sub
|
(reg-sub
|
||||||
:selected-group-contacts
|
:selected-group-contacts
|
||||||
:<- [:get :group/selected-contacts]
|
:<- [:get :group/selected-contacts]
|
||||||
:<- [:contacts/all-added-people-contacts]
|
:<- [:contacts/active]
|
||||||
(fn [[selected-contacts added-contacts]]
|
(fn [[selected-contacts active-contacts]]
|
||||||
(filter-contacts selected-contacts added-contacts)))
|
(filter-contacts selected-contacts active-contacts)))
|
||||||
|
|
|
@ -121,7 +121,7 @@
|
||||||
|
|
||||||
;; Start group chat
|
;; Start group chat
|
||||||
(views/defview contact-toggle-list []
|
(views/defview contact-toggle-list []
|
||||||
(views/letsubs [contacts [:contacts/all-added-people-contacts]
|
(views/letsubs [contacts [:contacts/active]
|
||||||
selected-contacts-count [:selected-contacts-count]]
|
selected-contacts-count [:selected-contacts-count]]
|
||||||
[react/keyboard-avoiding-view {:style styles/group-container}
|
[react/keyboard-avoiding-view {:style styles/group-container}
|
||||||
[status-bar/status-bar]
|
[status-bar/status-bar]
|
||||||
|
|
|
@ -211,7 +211,7 @@
|
||||||
(ethereum/normalized-address (:address contact))]]]])
|
(ethereum/normalized-address (:address contact))]]]])
|
||||||
|
|
||||||
(views/defview recent-recipients []
|
(views/defview recent-recipients []
|
||||||
(views/letsubs [contacts [:contacts/all-added-people-contacts]]
|
(views/letsubs [contacts [:contacts/active]]
|
||||||
[simple-screen
|
[simple-screen
|
||||||
[toolbar (i18n/label :t/recipient)]
|
[toolbar (i18n/label :t/recipient)]
|
||||||
[react/view styles/recent-recipients
|
[react/view styles/recent-recipients
|
||||||
|
|
|
@ -18,15 +18,11 @@
|
||||||
:address "eca8218b5ebeb2c47ba94c1b6e0a779d78fff7bc",
|
:address "eca8218b5ebeb2c47ba94c1b6e0a779d78fff7bc",
|
||||||
:name "User B",
|
:name "User B",
|
||||||
:fcm-token nil,
|
:fcm-token nil,
|
||||||
:dapp-url nil,
|
|
||||||
:dapp-hash nil,
|
|
||||||
:photo-path "photo1",
|
:photo-path "photo1",
|
||||||
:debug? false,
|
|
||||||
:status nil,
|
:status nil,
|
||||||
:bot-url nil,
|
:blocked? false,
|
||||||
:pending? true,
|
:pending? true,
|
||||||
:last-online 0,
|
:last-online 0,
|
||||||
:dapp? false,
|
|
||||||
:public-key
|
:public-key
|
||||||
"0x04985040682b77a32bb4bb58268a0719bd24ca4d07c255153fe1eb2ccd5883669627bd1a092d7cc76e8e4b9104327667b19dcda3ac469f572efabe588c38c1985f"}}
|
"0x04985040682b77a32bb4bb58268a0719bd24ca4d07c255153fe1eb2ccd5883669627bd1a092d7cc76e8e4b9104327667b19dcda3ac469f572efabe588c38c1985f"}}
|
||||||
current-account {:last-updated 0,
|
current-account {:last-updated 0,
|
||||||
|
@ -54,13 +50,9 @@
|
||||||
:address "eca8218b5ebeb2c47ba94c1b6e0a779d78fff7bc"
|
:address "eca8218b5ebeb2c47ba94c1b6e0a779d78fff7bc"
|
||||||
:name "User B"
|
:name "User B"
|
||||||
:fcm-token nil
|
:fcm-token nil
|
||||||
:dapp-url nil
|
|
||||||
:dapp-hash nil
|
|
||||||
:photo-path "photo1"
|
:photo-path "photo1"
|
||||||
:debug? false
|
|
||||||
:status nil
|
:status nil
|
||||||
:bot-url nil
|
:blocked? false
|
||||||
:pending? true
|
:pending? true
|
||||||
:last-online 0
|
:last-online 0
|
||||||
:dapp? false
|
|
||||||
:public-key "0x04985040682b77a32bb4bb58268a0719bd24ca4d07c255153fe1eb2ccd5883669627bd1a092d7cc76e8e4b9104327667b19dcda3ac469f572efabe588c38c1985f"}]))))))
|
:public-key "0x04985040682b77a32bb4bb58268a0719bd24ca4d07c255153fe1eb2ccd5883669627bd1a092d7cc76e8e4b9104327667b19dcda3ac469f572efabe588c38c1985f"}]))))))
|
||||||
|
|
Loading…
Reference in New Issue