Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
87821791cc |
@@ -22,8 +22,12 @@
|
||||
[]
|
||||
(let [{id :community-id} (rf/sub [:get-screen-params])
|
||||
{:keys [name color images]} (rf/sub [:communities/community id])
|
||||
airdrop-account (rf/sub [:communities/airdrop-account id])
|
||||
selected-accounts (rf/sub [:communities/selected-permission-accounts id])
|
||||
airdrop-account (rf/sub [:communities/airdrop-account-by-community-neww id])
|
||||
accounts-to-reveal (rf/sub [:communities/accounts-to-reveal-by-community-neww id])
|
||||
addresses-to-reveal (rf/sub [:communities/addresses-to-reveal-by-community-neww
|
||||
id])
|
||||
share-all-addresses? (rf/sub [:communities/share-all-addresses-by-community-neww
|
||||
id])
|
||||
{:keys [highest-permission-role]} (rf/sub [:community/token-gated-overview id])
|
||||
highest-role-text (i18n/label (communities.utils/role->translation-key
|
||||
highest-permission-role
|
||||
@@ -53,12 +57,14 @@
|
||||
{:list-type :settings
|
||||
:data [{:title (i18n/label :t/join-as-a {:role highest-role-text})
|
||||
:on-press #(rf/dispatch [:open-modal :addresses-for-permissions
|
||||
{:community-id id}])
|
||||
{:community-id id
|
||||
:share-all-addresses? share-all-addresses?
|
||||
:addresses-to-reveal addresses-to-reveal}])
|
||||
:description :text
|
||||
:action :arrow
|
||||
:label :preview
|
||||
:label-props {:type :accounts
|
||||
:data selected-accounts}
|
||||
:data accounts-to-reveal}
|
||||
:description-props {:text (i18n/label :t/all-addresses)}}
|
||||
{:title (i18n/label :t/for-airdrops)
|
||||
:on-press #(rf/dispatch [:open-modal :airdrop-addresses
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
(:require [quo.core :as quo]
|
||||
[react-native.core :as rn]
|
||||
[react-native.gesture :as gesture]
|
||||
[reagent.core :as r]
|
||||
[status-im.common.not-implemented :as not-implemented]
|
||||
[status-im.common.resources :as resources]
|
||||
[status-im.constants :as constants]
|
||||
@@ -40,7 +41,7 @@
|
||||
|
||||
(defn- account-item
|
||||
[{:keys [color address name emoji]} _ _
|
||||
{:keys [selected-addresses community-id share-all-addresses? community-color]}]
|
||||
{:keys [selected-addresses community-id share-all-addresses? community-color on-change]}]
|
||||
(let [balances (rf/sub [:communities/permissioned-balances-by-address community-id address])]
|
||||
[quo/account-permissions
|
||||
{:account {:name name
|
||||
@@ -50,23 +51,22 @@
|
||||
:token-details (balances->components-props balances)
|
||||
:checked? (contains? selected-addresses address)
|
||||
:disabled? share-all-addresses?
|
||||
:on-change #(rf/dispatch [:communities/toggle-selected-permission-address
|
||||
address community-id])
|
||||
:on-change #(on-change address)
|
||||
:container-style {:margin-bottom 8}
|
||||
:customization-color community-color}]))
|
||||
|
||||
(defn view
|
||||
[{:keys [scroll-enabled? on-scroll]}]
|
||||
(let [{id :community-id} (rf/sub [:get-screen-params])]
|
||||
(let [screen-params (rf/sub [:get-screen-params])
|
||||
id (:community-id screen-params)
|
||||
share-all-addresses? (r/atom (:share-all-addresses? screen-params))
|
||||
selected-addresses (r/atom (:addresses-to-reveal screen-params))]
|
||||
(rf/dispatch [:communities/get-permissioned-balances id])
|
||||
(fn []
|
||||
(let [{:keys [name color images]} (rf/sub [:communities/community id])
|
||||
{:keys [checking?
|
||||
highest-permission-role]} (rf/sub [:community/token-gated-overview id])
|
||||
accounts (rf/sub [:wallet/accounts-without-watched-accounts])
|
||||
selected-addresses (rf/sub [:communities/selected-permission-addresses id])
|
||||
share-all-addresses? (rf/sub [:communities/share-all-addresses? id])
|
||||
unsaved-address-changes? (rf/sub [:communities/unsaved-address-changes? id])]
|
||||
accounts (rf/sub [:wallet/accounts-without-watched-accounts])]
|
||||
[rn/safe-area-view {:style style/container}
|
||||
[quo/drawer-top
|
||||
{:type :context-tag
|
||||
@@ -83,18 +83,27 @@
|
||||
{:list-type :settings
|
||||
:data [{:title (i18n/label :t/share-all-current-and-future-addresses)
|
||||
:action :selector
|
||||
:action-props {:on-change #(rf/dispatch
|
||||
[:communities/toggle-share-all-addresses
|
||||
id])
|
||||
:action-props {:on-change #(swap! share-all-addresses?
|
||||
(fn [share-all?]
|
||||
(when (not share-all?)
|
||||
(reset! selected-addresses
|
||||
(set (map :address
|
||||
accounts))))
|
||||
(not share-all?)))
|
||||
:customization-color color
|
||||
:checked? share-all-addresses?}}]
|
||||
:checked? @share-all-addresses?}}]
|
||||
:container-style {:padding-bottom 16}}]
|
||||
|
||||
[gesture/flat-list
|
||||
{:render-fn account-item
|
||||
:render-data {:selected-addresses selected-addresses
|
||||
:render-data {:selected-addresses @selected-addresses
|
||||
:community-id id
|
||||
:share-all-addresses? share-all-addresses?
|
||||
:share-all-addresses? @share-all-addresses?
|
||||
:on-change #(swap! selected-addresses
|
||||
(fn [addresses]
|
||||
(if (contains? addresses %)
|
||||
(disj addresses %)
|
||||
(conj addresses %))))
|
||||
:community-color color}
|
||||
:content-container-style {:padding-horizontal 20}
|
||||
:scroll-enabled @scroll-enabled?
|
||||
@@ -107,28 +116,29 @@
|
||||
:button-one-label (i18n/label :t/confirm-changes)
|
||||
:button-one-props {:customization-color color
|
||||
:disabled? (or checking?
|
||||
(empty? selected-addresses)
|
||||
(empty? @selected-addresses)
|
||||
(not highest-permission-role)
|
||||
(not unsaved-address-changes?))
|
||||
(and (= @share-all-addresses?
|
||||
(:share-all-addresses? screen-params))
|
||||
(= @selected-addresses
|
||||
(:addresses-to-reveal screen-params))))
|
||||
:on-press (fn []
|
||||
(rf/dispatch
|
||||
[:communities/update-previous-permission-addresses
|
||||
id])
|
||||
[:communities/save-permission-address-changes-neww
|
||||
{:community-id id
|
||||
:addresses-to-reveal @selected-addresses
|
||||
:share-all-addresses? @share-all-addresses?}])
|
||||
(rf/dispatch [:navigate-back]))}
|
||||
:button-two-label (i18n/label :t/cancel)
|
||||
:button-two-props {:type :grey
|
||||
:on-press (fn []
|
||||
(rf/dispatch
|
||||
[:communities/reset-selected-permission-addresses id])
|
||||
(rf/dispatch [:navigate-back]))}
|
||||
:description (if (or (empty? selected-addresses)
|
||||
:on-press #(rf/dispatch [:navigate-back])}
|
||||
:description (if (or (empty? @selected-addresses)
|
||||
(not highest-permission-role))
|
||||
:top-error
|
||||
:top)
|
||||
:role (when-not checking? (role-keyword highest-permission-role))
|
||||
:error-message (cond
|
||||
(empty? selected-addresses) (i18n/label :t/no-addresses-selected)
|
||||
(empty? @selected-addresses) (i18n/label :t/no-addresses-selected)
|
||||
(not highest-permission-role) (i18n/label
|
||||
:t/addresses-dont-contain-tokens-needed)
|
||||
:else nil)}]]))))
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
{:account-props item
|
||||
:state (when (= airdrop-address (:address item)) :selected)
|
||||
:on-press (fn []
|
||||
(rf/dispatch [:communities/set-airdrop-address (:address item) community-id])
|
||||
(rf/dispatch [:communities/update-airdrop-address-neww
|
||||
{:community-id community-id :address (:address item)}])
|
||||
(rf/dispatch [:navigate-back]))
|
||||
:emoji (:emoji item)}])
|
||||
|
||||
@@ -21,8 +22,8 @@
|
||||
[]
|
||||
(let [{id :community-id} (rf/sub [:get-screen-params])
|
||||
{:keys [name images color]} (rf/sub [:communities/community id])
|
||||
selected-accounts (rf/sub [:communities/selected-permission-accounts id])
|
||||
airdrop-address (rf/sub [:communities/airdrop-address id])]
|
||||
accounts-to-reveal (rf/sub [:communities/accounts-to-reveal-by-community-neww id])
|
||||
airdrop-address (rf/sub [:communities/airdrop-address-by-community-neww id])]
|
||||
[:<>
|
||||
[quo/drawer-top
|
||||
{:type :context-tag
|
||||
@@ -34,7 +35,7 @@
|
||||
:community-logo (get-in images [:thumbnail :uri])
|
||||
:customization-color color}]
|
||||
[rn/flat-list
|
||||
{:data selected-accounts
|
||||
{:data accounts-to-reveal
|
||||
:render-fn render-item
|
||||
:render-data [airdrop-address id]
|
||||
:content-container-style style/account-list-container
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
type
|
||||
constants/community-token-permission-can-view-and-post-channel))))]
|
||||
{:db (assoc-in db [:communities id] community)
|
||||
:fx [[:dispatch [:communities/initialize-permission-addresses id]]
|
||||
:fx [[:dispatch [:communities/initialize-permission-addresses-neww id]]
|
||||
(when (not joined)
|
||||
[:dispatch [:chat.ui/spectate-community id]])
|
||||
(when (nil? token-permissions-check)
|
||||
@@ -161,96 +161,62 @@
|
||||
:on-success #(rf/dispatch [:communities/fetched-collapsed-categories-success %])
|
||||
:on-error #(log/error "failed to fetch collapsed community categories" %)}]}))
|
||||
|
||||
(defn initialize-permission-addresses
|
||||
;; (defn initialize-permission-addresses
|
||||
;; [{:keys [db]} [community-id]]
|
||||
;; (when community-id
|
||||
;; (let [accounts (utils/sorted-non-watch-only-accounts db)
|
||||
;; addresses (set (map :address accounts))]
|
||||
;; {:db (update-in db
|
||||
;; [:communities community-id]
|
||||
;; assoc
|
||||
;; :previous-share-all-addresses? true
|
||||
;; :share-all-addresses? true
|
||||
;; :previous-permission-addresses addresses
|
||||
;; :selected-permission-addresses addresses
|
||||
;; :airdrop-address (:address (first accounts)))})))
|
||||
|
||||
;; (rf/reg-event-fx :communities/initialize-permission-addresses
|
||||
;; initialize-permission-addresses)
|
||||
|
||||
(defn initialize-permission-addresses-neww
|
||||
[{:keys [db]} [community-id]]
|
||||
(when community-id
|
||||
(let [accounts (utils/sorted-non-watch-only-accounts db)
|
||||
addresses (set (map :address accounts))]
|
||||
{:db (update-in db
|
||||
[:communities community-id]
|
||||
assoc
|
||||
:previous-share-all-addresses? true
|
||||
:share-all-addresses? true
|
||||
:previous-permission-addresses addresses
|
||||
:selected-permission-addresses addresses
|
||||
:airdrop-address (:address (first accounts)))})))
|
||||
{:db (-> db
|
||||
(assoc-in [:communities/share-all-addresses community-id] true)
|
||||
(assoc-in [:communities/addresses-to-reveal community-id] addresses)
|
||||
(assoc-in [:communities/airdrop-address community-id] (:address (first accounts))))})))
|
||||
|
||||
(rf/reg-event-fx :communities/initialize-permission-addresses
|
||||
initialize-permission-addresses)
|
||||
(rf/reg-event-fx :communities/initialize-permission-addresses-neww
|
||||
initialize-permission-addresses-neww)
|
||||
|
||||
(defn update-previous-permission-addresses
|
||||
[{:keys [db]} [community-id]]
|
||||
(defn save-permission-address-changes-neww
|
||||
[{:keys [db]} [{:keys [community-id share-all-addresses? addresses-to-reveal]}]]
|
||||
(when community-id
|
||||
(let [accounts (utils/sorted-non-watch-only-accounts db)
|
||||
selected-permission-addresses (get-in db
|
||||
[:communities community-id
|
||||
:selected-permission-addresses])
|
||||
selected-accounts (filter #(contains? selected-permission-addresses (:address %))
|
||||
accounts)
|
||||
current-airdrop-address (get-in db [:communities community-id :airdrop-address])
|
||||
share-all-addresses? (get-in db [:communities community-id :share-all-addresses?])]
|
||||
{:db (update-in db
|
||||
[:communities community-id]
|
||||
assoc
|
||||
:previous-share-all-addresses? share-all-addresses?
|
||||
:previous-permission-addresses selected-permission-addresses
|
||||
:airdrop-address (if (contains? selected-permission-addresses
|
||||
current-airdrop-address)
|
||||
current-airdrop-address
|
||||
(:address (first selected-accounts))))})))
|
||||
(let [current-airdrop-address (get-in db [:communities/airdrop-address community-id])
|
||||
accounts (utils/sorted-non-watch-only-accounts db)
|
||||
accounts-to-reveal (filter #(contains? addresses-to-reveal (:address %))
|
||||
accounts)]
|
||||
{:db (-> db
|
||||
(assoc-in [:communities/share-all-addresses community-id] share-all-addresses?)
|
||||
(assoc-in [:communities/addresses-to-reveal community-id] addresses-to-reveal)
|
||||
(assoc-in [:communities/airdrop-address community-id]
|
||||
(if (contains? addresses-to-reveal
|
||||
current-airdrop-address)
|
||||
current-airdrop-address
|
||||
(:address (first accounts-to-reveal)))))})))
|
||||
|
||||
(rf/reg-event-fx :communities/update-previous-permission-addresses
|
||||
update-previous-permission-addresses)
|
||||
(rf/reg-event-fx :communities/save-permission-address-changes-neww
|
||||
save-permission-address-changes-neww)
|
||||
|
||||
(defn toggle-selected-permission-address
|
||||
[{:keys [db]} [address community-id]]
|
||||
(let [selected-permission-addresses
|
||||
(get-in db [:communities community-id :selected-permission-addresses])
|
||||
updated-selected-permission-addresses
|
||||
(if (contains? selected-permission-addresses address)
|
||||
(disj selected-permission-addresses address)
|
||||
(conj selected-permission-addresses address))]
|
||||
{:db (assoc-in db
|
||||
[:communities community-id :selected-permission-addresses]
|
||||
updated-selected-permission-addresses)
|
||||
:fx [(when community-id
|
||||
[:dispatch
|
||||
[:communities/check-permissions-to-join-community community-id
|
||||
updated-selected-permission-addresses :based-on-client-selection]])]}))
|
||||
(defn update-airdrop-address-neww
|
||||
[{:keys [db]} [{:keys [community-id address]}]]
|
||||
(when community-id
|
||||
{:db (assoc-in db [:communities/airdrop-address community-id] address)}))
|
||||
|
||||
(rf/reg-event-fx :communities/toggle-selected-permission-address
|
||||
toggle-selected-permission-address)
|
||||
|
||||
(defn toggle-share-all-addresses
|
||||
[{:keys [db]} [community-id]]
|
||||
(let [share-all-addresses? (get-in db [:communities community-id :share-all-addresses?])
|
||||
next-share-all-addresses? (not share-all-addresses?)
|
||||
accounts (utils/sorted-non-watch-only-accounts db)
|
||||
addresses (set (map :address accounts))]
|
||||
{:db (update-in db
|
||||
[:communities community-id]
|
||||
assoc
|
||||
:share-all-addresses? next-share-all-addresses?
|
||||
:selected-permission-addresses addresses)
|
||||
:fx [(when (and community-id next-share-all-addresses?)
|
||||
[:dispatch
|
||||
[:communities/check-permissions-to-join-community community-id
|
||||
addresses :based-on-client-selection]])]}))
|
||||
|
||||
(rf/reg-event-fx :communities/toggle-share-all-addresses
|
||||
toggle-share-all-addresses)
|
||||
|
||||
(rf/reg-event-fx :communities/reset-selected-permission-addresses
|
||||
(fn [{:keys [db]} [community-id]]
|
||||
(when community-id
|
||||
{:db (update-in db
|
||||
[:communities community-id]
|
||||
assoc
|
||||
:selected-permission-addresses
|
||||
(get-in db [:communities community-id :previous-permission-addresses])
|
||||
:share-all-addresses?
|
||||
(get-in db [:communities community-id :previous-share-all-addresses?]))
|
||||
:fx [[:dispatch [:communities/check-permissions-to-join-community community-id]]]})))
|
||||
(rf/reg-event-fx :communities/update-airdrop-address-neww
|
||||
update-airdrop-address-neww)
|
||||
|
||||
(rf/reg-event-fx :communities/get-community-channel-share-data
|
||||
(fn [_ [chat-id on-success]]
|
||||
|
||||
@@ -8,99 +8,6 @@
|
||||
|
||||
(def community-id "community-id")
|
||||
|
||||
(deftest initialize-permission-addresses-test
|
||||
(let [initial-db {:db {:wallet {:accounts {"0x1" {:address "0x1"
|
||||
:position 0}
|
||||
"0x2" {:address "0x2"
|
||||
:position 1}}}}}
|
||||
expected-db {:db (update-in (:db initial-db)
|
||||
[:communities community-id]
|
||||
assoc
|
||||
:share-all-addresses? true
|
||||
:previous-share-all-addresses? true
|
||||
:previous-permission-addresses #{"0x1" "0x2"}
|
||||
:selected-permission-addresses #{"0x1" "0x2"}
|
||||
:airdrop-address "0x1")}]
|
||||
(is (match? expected-db (events/initialize-permission-addresses initial-db [community-id])))))
|
||||
|
||||
(deftest toggle-selected-permission-address-test
|
||||
(let [initial-db {:db {:communities {community-id {:selected-permission-addresses #{"0x1" "0x2"}}}}}]
|
||||
(is (match? {:db {:communities {community-id {:selected-permission-addresses #{"0x1"}}}}}
|
||||
(events/toggle-selected-permission-address initial-db ["0x2" community-id])))
|
||||
(is (match? {:db {:communities {community-id {:selected-permission-addresses #{"0x1" "0x2" "0x3"}}}}}
|
||||
(events/toggle-selected-permission-address initial-db ["0x3" community-id])))))
|
||||
|
||||
(deftest update-previous-permission-addresses-test
|
||||
(let [wallet {:accounts {"0x1" {:address "0x1"
|
||||
:position 0}
|
||||
"0x2" {:address "0x2"
|
||||
:position 1}
|
||||
"0x3" {:address "0x3"
|
||||
:position 2}}}]
|
||||
(let [initial-db {:db {:wallet wallet
|
||||
:communities {community-id {:previous-permission-addresses #{"0x1" "0x2"}
|
||||
:selected-permission-addresses #{"0x1" "0x2"
|
||||
"0x3"}
|
||||
:share-all-addresses? true
|
||||
:previous-share-all-addresses? false
|
||||
:airdrop-address "0x1"}}}}
|
||||
expected-db {:db {:wallet wallet
|
||||
:communities {community-id {:previous-permission-addresses #{"0x1" "0x2"
|
||||
"0x3"}
|
||||
:selected-permission-addresses #{"0x1" "0x2"
|
||||
"0x3"}
|
||||
:share-all-addresses? true
|
||||
:previous-share-all-addresses? true
|
||||
:airdrop-address "0x1"}}}}]
|
||||
(is
|
||||
(match? expected-db
|
||||
(events/update-previous-permission-addresses initial-db [community-id]))))
|
||||
(let [initial-db {:db {:wallet wallet
|
||||
:communities {community-id {:previous-permission-addresses #{"0x1" "0x2"}
|
||||
:selected-permission-addresses #{"0x2" "0x3"}
|
||||
:airdrop-address "0x1"}}}}
|
||||
expected-db {:db {:wallet wallet
|
||||
:communities {community-id {:previous-permission-addresses #{"0x2" "0x3"}
|
||||
:selected-permission-addresses #{"0x2" "0x3"}
|
||||
:airdrop-address "0x2"}}}}]
|
||||
(is
|
||||
(match? expected-db
|
||||
(events/update-previous-permission-addresses initial-db [community-id]))))))
|
||||
|
||||
(deftest toggle-share-all-addresses-test
|
||||
(let [initial-db {:db {:wallet {:accounts {"0x1" {:address "0x1"
|
||||
:position 0}
|
||||
"0x2" {:address "0x2"
|
||||
:position 1}}}
|
||||
:communities {community-id {:share-all-addresses? true
|
||||
:previous-share-all-addresses? true
|
||||
:previous-permission-addresses #{"0x1" "0x2"}
|
||||
:selected-permission-addresses #{"0x1" "0x2"}
|
||||
:airdrop-address "0x1"}}}}
|
||||
expected-db (update-in initial-db
|
||||
[:db :communities community-id]
|
||||
assoc
|
||||
:previous-share-all-addresses? true
|
||||
:share-all-addresses?
|
||||
false)]
|
||||
(is (match? expected-db (events/toggle-share-all-addresses initial-db [community-id]))))
|
||||
(let [initial-db {:db {:wallet {:accounts {"0x1" {:address "0x1"
|
||||
:position 0}
|
||||
"0x2" {:address "0x2"
|
||||
:position 1}}}
|
||||
:communities {community-id {:share-all-addresses? false
|
||||
:previous-share-all-addresses? false
|
||||
:previous-permission-addresses #{"0x1"}
|
||||
:selected-permission-addresses #{"0x1"}
|
||||
:airdrop-address "0x1"}}}}
|
||||
expected-db (update-in initial-db
|
||||
[:db :communities community-id]
|
||||
assoc
|
||||
:selected-permission-addresses #{"0x1" "0x2"}
|
||||
:previous-share-all-addresses? false
|
||||
:share-all-addresses? true)]
|
||||
(is (match? expected-db (events/toggle-share-all-addresses initial-db [community-id])))))
|
||||
|
||||
(deftest fetch-community
|
||||
(testing "with community id"
|
||||
(testing "update fetching indicator in db"
|
||||
@@ -265,7 +172,7 @@
|
||||
(is (match? community-id
|
||||
(-> effects :db :communities (get community-id) :id)))
|
||||
(is (match?
|
||||
[[:dispatch [:communities/initialize-permission-addresses community-id]]
|
||||
[[:dispatch [:communities/initialize-permission-addresses-neww community-id]]
|
||||
[:dispatch [:chat.ui/spectate-community community-id]]
|
||||
[:dispatch [:communities/check-permissions-to-join-community community-id]]]
|
||||
(filter some? (:fx effects))))))
|
||||
@@ -273,7 +180,7 @@
|
||||
(let [community (assoc community :joined true)
|
||||
effects (events/handle-community {} [community])]
|
||||
(is (match?
|
||||
[[:dispatch [:communities/initialize-permission-addresses community-id]]
|
||||
[[:dispatch [:communities/initialize-permission-addresses-neww community-id]]
|
||||
[:dispatch [:communities/check-permissions-to-join-community community-id]]
|
||||
[:dispatch [:communities/get-revealed-accounts community-id]]]
|
||||
(filter some? (:fx effects))))))
|
||||
@@ -281,7 +188,7 @@
|
||||
(let [community (assoc community :token-permissions-check :fake-token-permissions-check)
|
||||
effects (events/handle-community {} [community])]
|
||||
(is (match?
|
||||
[[:dispatch [:communities/initialize-permission-addresses community-id]]
|
||||
[[:dispatch [:communities/initialize-permission-addresses-neww community-id]]
|
||||
[:dispatch [:chat.ui/spectate-community community-id]]]
|
||||
(filter some? (:fx effects))))))
|
||||
(testing "given a community with view channel permission"
|
||||
@@ -290,7 +197,7 @@
|
||||
[["perm-id" {:type constants/community-token-permission-can-view-channel}]])
|
||||
effects (events/handle-community {} [community])]
|
||||
(is (match?
|
||||
[[:dispatch [:communities/initialize-permission-addresses community-id]]
|
||||
[[:dispatch [:communities/initialize-permission-addresses-neww community-id]]
|
||||
[:dispatch [:chat.ui/spectate-community community-id]]
|
||||
[:dispatch [:communities/check-permissions-to-join-community community-id]]
|
||||
[:dispatch
|
||||
@@ -304,7 +211,7 @@
|
||||
{:type constants/community-token-permission-can-view-and-post-channel}]])
|
||||
effects (events/handle-community {} [community])]
|
||||
(is (match?
|
||||
[[:dispatch [:communities/initialize-permission-addresses community-id]]
|
||||
[[:dispatch [:communities/initialize-permission-addresses-neww community-id]]
|
||||
[:dispatch [:chat.ui/spectate-community community-id]]
|
||||
[:dispatch [:communities/check-permissions-to-join-community community-id]]
|
||||
[:dispatch
|
||||
|
||||
@@ -368,6 +368,40 @@
|
||||
(fn [[{:keys [selected-permission-addresses]}] _]
|
||||
selected-permission-addresses))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:communities/share-all-addresses-by-community-neww
|
||||
:<- [:communities/share-all-addresses-neww]
|
||||
(fn [share-all-addresses [_ community-id]]
|
||||
(get share-all-addresses community-id)))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:communities/addresses-to-reveal-by-community-neww
|
||||
:<- [:communities/addresses-to-reveal-neww]
|
||||
(fn [addresses [_ community-id]]
|
||||
(get addresses community-id)))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:communities/accounts-to-reveal-by-community-neww
|
||||
(fn [[_ community-id]]
|
||||
[(re-frame/subscribe [:wallet/accounts-without-watched-accounts])
|
||||
(re-frame/subscribe [:communities/addresses-to-reveal-by-community-neww community-id])])
|
||||
(fn [[accounts addresses-to-reveal]]
|
||||
(filter #(contains? addresses-to-reveal (:address %)) accounts)))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:communities/airdrop-address-by-community-neww
|
||||
:<- [:communities/airdrop-address-neww]
|
||||
(fn [address [_ community-id]]
|
||||
(get address community-id)))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:communities/airdrop-account-by-community-neww
|
||||
(fn [[_ community-id]]
|
||||
[(re-frame/subscribe [:wallet/accounts-without-watched-accounts])
|
||||
(re-frame/subscribe [:communities/airdrop-address-by-community-neww community-id])])
|
||||
(fn [[accounts airdrop-address]]
|
||||
(first (filter #(= (:address %) airdrop-address) accounts))))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:communities/share-all-addresses?
|
||||
(fn [[_ community-id]]
|
||||
|
||||
@@ -150,6 +150,9 @@
|
||||
(reg-root-key-sub :communities/permissioned-balances :communities/permissioned-balances)
|
||||
(reg-root-key-sub :communities/permissions-check :communities/permissions-check)
|
||||
(reg-root-key-sub :communities/channel-permissions-check :communities/channel-permissions-check)
|
||||
(reg-root-key-sub :communities/share-all-addresses-neww :communities/share-all-addresses)
|
||||
(reg-root-key-sub :communities/addresses-to-reveal-neww :communities/addresses-to-reveal)
|
||||
(reg-root-key-sub :communities/airdrop-address-neww :communities/airdrop-address)
|
||||
|
||||
;;activity center
|
||||
(reg-root-key-sub :activity-center :activity-center)
|
||||
|
||||
Reference in New Issue
Block a user