mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-30 10:26:24 +00:00
Check eligibility status after enabling the share all addresses toggle
This commit is contained in:
parent
ae75eaeb33
commit
ae08cb161f
@ -223,16 +223,19 @@
|
|||||||
|
|
||||||
(defn toggle-share-all-addresses
|
(defn toggle-share-all-addresses
|
||||||
[{:keys [db]} [community-id]]
|
[{:keys [db]} [community-id]]
|
||||||
(let [share-all-addresses? (get-in db [:communities community-id :share-all-addresses?])
|
(let [share-all-addresses? (get-in db [:communities community-id :share-all-addresses?])
|
||||||
accounts (utils/sorted-non-watch-only-accounts db)
|
next-share-all-addresses? (not share-all-addresses?)
|
||||||
addresses (set (map :address accounts))]
|
accounts (utils/sorted-non-watch-only-accounts db)
|
||||||
|
addresses (set (map :address accounts))]
|
||||||
{:db (update-in db
|
{:db (update-in db
|
||||||
[:communities community-id]
|
[:communities community-id]
|
||||||
(fn [community]
|
assoc
|
||||||
(-> community
|
:share-all-addresses? next-share-all-addresses?
|
||||||
(assoc :share-all-addresses? (not share-all-addresses?))
|
:selected-permission-addresses addresses)
|
||||||
(cond-> (not share-all-addresses?)
|
:fx [(when (and community-id next-share-all-addresses?)
|
||||||
(assoc :selected-permission-addresses addresses)))))}))
|
[:dispatch
|
||||||
|
[:communities/check-permissions-to-join-community community-id
|
||||||
|
addresses :based-on-client-selection]])]}))
|
||||||
|
|
||||||
(rf/reg-event-fx :communities/toggle-share-all-addresses
|
(rf/reg-event-fx :communities/toggle-share-all-addresses
|
||||||
toggle-share-all-addresses)
|
toggle-share-all-addresses)
|
||||||
|
@ -74,8 +74,8 @@
|
|||||||
:position 1}}}
|
:position 1}}}
|
||||||
:communities {community-id {:share-all-addresses? true
|
:communities {community-id {:share-all-addresses? true
|
||||||
:previous-share-all-addresses? true
|
:previous-share-all-addresses? true
|
||||||
:previous-permission-addresses #{"0x1"}
|
:previous-permission-addresses #{"0x1" "0x2"}
|
||||||
:selected-permission-addresses #{"0x1"}
|
:selected-permission-addresses #{"0x1" "0x2"}
|
||||||
:airdrop-address "0x1"}}}}
|
:airdrop-address "0x1"}}}}
|
||||||
expected-db (update-in initial-db
|
expected-db (update-in initial-db
|
||||||
[:db :communities community-id]
|
[:db :communities community-id]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user