Show token permissions only for role permissions (#18549)

Token requirements that are not role permissions (currently channel permissions)
should not be displayed to the user while they see permissions to join.

Admin, Master, Owner or minted token permissions are not membership permissions,
but they still should be displayed so the user understand the role they will
assume after joining.

Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
This commit is contained in:
Ajay Sivan 2024-02-01 05:33:54 +05:30 committed by GitHub
parent 7e31e028fa
commit 4633fc22ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 160 additions and 167 deletions

View File

@ -44,22 +44,37 @@
[categ] [categ]
(reduce-kv #(assoc %1 (name %2) %3) {} categ)) (reduce-kv #(assoc %1 (name %2) %3) {} categ))
(defn role-permission?
[token-permission]
(contains? constants/community-role-permissions (:type token-permission)))
(defn membership-permission?
[token-permission]
(= (:type token-permission) constants/community-token-permission-become-member))
(defn <-rpc (defn <-rpc
[c] [c]
(-> c (-> c
(set/rename-keys {:canRequestAccess :can-request-access? (set/rename-keys
:canManageUsers :can-manage-users? {:canRequestAccess :can-request-access?
:canDeleteMessageForEveryone :can-delete-message-for-everyone? :canManageUsers :can-manage-users?
:canJoin :can-join? :canDeleteMessageForEveryone :can-delete-message-for-everyone?
:requestedToJoinAt :requested-to-join-at ;; This flag is misleading based on its name alone
:isMember :is-member? ;; because it should not be used to decide if the user
:adminSettings :admin-settings ;; is *allowed* to join. Allowance is based on token
:tokenPermissions :token-permissions ;; permissions. Still, the flag can be used to know
:communityTokensMetadata :tokens-metadata ;; whether or not the user will have to wait until an
:introMessage :intro-message ;; admin approves a join request.
:muteTill :muted-till :canJoin :can-join?
:lastOpenedAt :last-opened-at :requestedToJoinAt :requested-to-join-at
:joinedAt :joined-at}) :isMember :is-member?
:adminSettings :admin-settings
:tokenPermissions :token-permissions
:communityTokensMetadata :tokens-metadata
:introMessage :intro-message
:muteTill :muted-till
:lastOpenedAt :last-opened-at
:joinedAt :joined-at})
(update :admin-settings (update :admin-settings
set/rename-keys set/rename-keys
{:pinMessageAllMembersEnabled :pin-message-all-members-enabled?}) {:pinMessageAllMembersEnabled :pin-message-all-members-enabled?})
@ -67,9 +82,16 @@
(update :chats <-chats-rpc) (update :chats <-chats-rpc)
(update :token-permissions seq) (update :token-permissions seq)
(update :categories <-categories-rpc) (update :categories <-categories-rpc)
(assoc :role-permissions?
(->> c
:tokenPermissions
vals
(some role-permission?)))
(assoc :membership-permissions? (assoc :membership-permissions?
(some #(= (:type %) constants/community-token-permission-become-member) (->> c
(vals (:tokenPermissions c)))) :tokenPermissions
vals
(some membership-permission?)))
(assoc :token-images (assoc :token-images
(reduce (fn [acc {sym :symbol image :image}] (reduce (fn [acc {sym :symbol image :image}]
(assoc acc sym image)) (assoc acc sym image))

View File

@ -160,7 +160,7 @@
(def default-kdf-iterations 3200) (def default-kdf-iterations 3200)
(def community-accounts-selection-enabled? false) (def community-accounts-selection-enabled? (enabled? (get-config :ACCOUNT_SELECTION_ENABLED "1")))
(def fetch-messages-enabled? (enabled? (get-config :FETCH_MESSAGES_ENABLED "1"))) (def fetch-messages-enabled? (enabled? (get-config :FETCH_MESSAGES_ENABLED "1")))
(def wallet-feature-flags (def wallet-feature-flags

View File

@ -153,6 +153,11 @@
(def ^:const community-token-permission-can-view-and-post-channel 4) (def ^:const community-token-permission-can-view-and-post-channel 4)
(def ^:const community-token-permission-become-token-master 5) (def ^:const community-token-permission-become-token-master 5)
(def ^:const community-token-permission-become-token-owner 6) (def ^:const community-token-permission-become-token-owner 6)
(def ^:const community-role-permissions
#{community-token-permission-become-admin
community-token-permission-become-member
community-token-permission-become-token-master
community-token-permission-become-token-owner})
;; Community rules for joining ;; Community rules for joining
(def ^:const community-rule-ens-only "ens-only") (def ^:const community-rule-ens-only "ens-only")

View File

@ -23,10 +23,8 @@
(defn- view-internal (defn- view-internal
[{:keys [theme]}] [{:keys [theme]}]
(fn [] (fn []
(let [{:keys [name (let [{:keys [id]} (rf/sub [:get-screen-params])
id {:keys [color name images]} (rf/sub [:communities/community id])]
images]} (rf/sub [:get-screen-params])
{:keys [color]} (rf/sub [:communities/community id])]
[rn/safe-area-view {:flex 1} [rn/safe-area-view {:flex 1}
[gesture/scroll-view {:style style/container} [gesture/scroll-view {:style style/container}
[rn/view style/page-container [rn/view style/page-container

View File

@ -7,7 +7,6 @@
[react-native.core :as rn] [react-native.core :as rn]
[reagent.core :as reagent] [reagent.core :as reagent]
[status-im.common.home.actions.view :as actions] [status-im.common.home.actions.view :as actions]
[status-im.common.password-authentication.view :as password-authentication]
[status-im.common.scroll-page.style :as scroll-page.style] [status-im.common.scroll-page.style :as scroll-page.style]
[status-im.common.scroll-page.view :as scroll-page] [status-im.common.scroll-page.view :as scroll-page]
[status-im.config :as config] [status-im.config :as config]
@ -15,38 +14,20 @@
[status-im.contexts.communities.actions.chat.view :as chat-actions] [status-im.contexts.communities.actions.chat.view :as chat-actions]
[status-im.contexts.communities.actions.community-options.view :as options] [status-im.contexts.communities.actions.community-options.view :as options]
[status-im.contexts.communities.overview.style :as style] [status-im.contexts.communities.overview.style :as style]
[status-im.contexts.communities.overview.utils :as utils]
[status-im.contexts.communities.utils :as communities.utils] [status-im.contexts.communities.utils :as communities.utils]
[utils.debounce :as debounce] [utils.debounce :as debounce]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
(defn preview-user-list (defn- add-category-height
[user-list]
(when (seq user-list)
[rn/view style/preview-user
[quo/preview-list
{:type :user
:number (count user-list)
:size :size-24}
user-list]
[quo/text
{:accessibility-label :communities-screen-title
:style {:margin-left 8}
:size :label}
(utils/join-existing-users-string user-list)]]))
(defn add-category-height
[categories-heights category height] [categories-heights category height]
(swap! categories-heights (swap! categories-heights assoc category height))
(fn [heights]
(assoc heights category height))))
(defn collapse-category (defn- collapse-category
[community-id category-id collapsed?] [community-id category-id collapsed?]
(rf/dispatch [:communities/toggle-collapsed-category community-id category-id (not collapsed?)])) (rf/dispatch [:communities/toggle-collapsed-category community-id category-id (not collapsed?)]))
(defn layout-y (defn- layout-y
[event] [event]
(oops/oget event "nativeEvent.layout.y")) (oops/oget event "nativeEvent.layout.y"))
@ -77,7 +58,7 @@
{:on-press on-press {:on-press on-press
:on-long-press #(rf/dispatch [:show-bottom-sheet channel-sheet-data])})]])) :on-long-press #(rf/dispatch [:show-bottom-sheet channel-sheet-data])})]]))
(defn channel-list-component (defn- channel-list-component
[{:keys [on-category-layout community-id community-color on-first-channel-height-changed]} [{:keys [on-category-layout community-id community-color on-first-channel-height-changed]}
channels-list] channels-list]
[rn/view [rn/view
@ -104,7 +85,7 @@
^{:key (:id chat)} ^{:key (:id chat)}
[channel-chat-item community-id community-color chat])])])]) [channel-chat-item community-id community-color chat])])])])
(defn get-access-type (defn- get-access-type
[access] [access]
(condp = access (condp = access
constants/community-no-membership-access :open constants/community-no-membership-access :open
@ -112,17 +93,9 @@
constants/community-on-request-access :request-access constants/community-on-request-access :request-access
:unknown-access)) :unknown-access))
(defn join-gated-community (defn- info-button
[id]
(rf/dispatch [:password-authentication/show
{:content (fn [] [password-authentication/view])}
{:label (i18n/label :t/join-open-community)
:on-press #(rf/dispatch [:communities/request-to-join
{:community-id id :password %}])}]))
(defn info-button
[] []
[rn/touchable-without-feedback [rn/pressable
{:on-press {:on-press
#(rf/dispatch #(rf/dispatch
[:show-bottom-sheet [:show-bottom-sheet
@ -137,119 +110,116 @@
[rn/view [rn/view
[quo/icon :i/info {:no-color true}]]]) [quo/icon :i/info {:no-color true}]]])
(defn token-gates (defn- token-requirements
[] [{:keys [id color]}]
(fn [{:keys [id color]}] (let [{:keys [can-request-access?
(let [{:keys [can-request-access? number-of-hold-tokens tokens
number-of-hold-tokens tokens highest-permission-role]} (rf/sub [:community/token-gated-overview id])
highest-permission-role]} (rf/sub [:community/token-gated-overview id]) highest-role-text
highest-role-text (i18n/label
(i18n/label (communities.utils/role->translation-key highest-permission-role :t/member))]
(communities.utils/role->translation-key highest-permission-role :t/member))] [rn/view {:style (style/token-gated-container)}
[rn/view {:style (style/token-gated-container)} [rn/view
[rn/view {:style {:padding-horizontal 12
{:style {:padding-horizontal 12 :flex-direction :row
:flex-direction :row :align-items :center
:align-items :center :justify-content :space-between
:justify-content :space-between :flex 1}}
:flex 1}} [quo/text {:weight :medium}
[quo/text {:weight :medium} (if can-request-access?
(if can-request-access? (i18n/label :t/you-eligible-to-join-as {:role highest-role-text})
(i18n/label :t/you-eligible-to-join-as {:role highest-role-text}) (i18n/label :t/you-not-eligible-to-join))]
(i18n/label :t/you-not-eligible-to-join))] [info-button]]
[info-button]] (when (pos? number-of-hold-tokens)
(when (pos? number-of-hold-tokens) [quo/text {:style {:padding-horizontal 12 :padding-bottom 18} :size :paragraph-2}
[quo/text {:style {:padding-horizontal 12 :padding-bottom 18} :size :paragraph-2} (if can-request-access?
(if can-request-access? (i18n/label :t/you-hold-number-of-hold-tokens-of-these
(i18n/label :t/you-hold-number-of-hold-tokens-of-these {:number-of-hold-tokens number-of-hold-tokens})
{:number-of-hold-tokens number-of-hold-tokens}) (i18n/label :t/you-must-hold))])
(i18n/label :t/you-must-hold))]) [quo/token-requirement-list
[quo/token-requirement-list {:tokens tokens
{:tokens tokens :padding? true}]
:padding? true}] [quo/button
[quo/button {:on-press (if config/community-accounts-selection-enabled?
{:on-press #(rf/dispatch [:open-modal :community-account-selection
(if config/community-accounts-selection-enabled? {:community-id id}])
#(rf/dispatch [:open-modal :community-account-selection {:community-id id}]) #(rf/dispatch [:open-modal :community-requests-to-join {:id id}]))
#(join-gated-community id)) :accessibility-label :join-community-button
:accessibility-label :join-community-button :customization-color color
:customization-color color :container-style {:margin-horizontal 12 :margin-top 12 :margin-bottom 12}
:container-style {:margin-horizontal 12 :margin-top 12 :margin-bottom 12} :disabled? (not can-request-access?)
:disabled? (not can-request-access?) :icon-left (if can-request-access? :i/unlocked :i/locked)}
:icon-left (if can-request-access? :i/unlocked :i/locked)} (i18n/label :t/join-open-community)]]))
(i18n/label :t/join-open-community)]])))
(defn join-community (defn- join-community
[{:keys [joined color permissions token-permissions membership-permissions? id] :as community} [{:keys [id color joined permissions role-permissions? can-join?] :as community}]
pending?] (let [pending? (rf/sub [:communities/my-pending-request-to-join id])
(let [access-type (get-access-type (:access permissions)) access-type (get-access-type (:access permissions))
unknown-access? (= access-type :unknown-access) unknown-access? (= access-type :unknown-access)
invite-only? (= access-type :invite-only)] invite-only? (= access-type :invite-only)]
[:<> [:<>
(when-not (or joined pending? invite-only? unknown-access?) (when-not (or joined pending? invite-only? unknown-access?)
(if membership-permissions? (if role-permissions?
[token-gates community] [token-requirements community]
[quo/button [quo/button
{:on-press {:on-press (if config/community-accounts-selection-enabled?
(if config/community-accounts-selection-enabled? #(rf/dispatch [:open-modal :community-account-selection
#(rf/dispatch [:open-modal :community-account-selection {:community-id id}]) {:community-id id}])
#(rf/dispatch [:open-modal :community-requests-to-join community])) #(rf/dispatch [:open-modal :community-requests-to-join {:id id}]))
:accessibility-label :show-request-to-join-screen-button :accessibility-label :show-request-to-join-screen-button
:customization-color color :customization-color color
:icon-left :i/communities} :icon-left :i/communities}
(i18n/label :t/request-to-join)])) (i18n/label :t/request-to-join)]))
(when (not (or pending? role-permissions? can-join?))
(when (not (or joined pending? token-permissions))
[quo/text [quo/text
{:size :paragraph-2 {:size :paragraph-2
:weight :regular :weight :regular
:style style/review-notice} :style style/review-notice}
(i18n/label :t/community-admins-will-review-your-request)])])) (i18n/label :t/community-admins-will-review-your-request)])]))
(defn status-tag (defn- status-tag
[pending? joined] [community-id joined]
(when (or pending? joined) (let [pending? (rf/sub [:communities/my-pending-request-to-join community-id])]
[rn/view {:style {:position :absolute :top 12 :right 12}} (when (or pending? joined)
[quo/status-tag [rn/view {:style {:position :absolute :top 12 :right 12}}
{:status {:type (if joined :positive :pending)} [quo/status-tag
:label (if joined {:status {:type (if joined :positive :pending)}
(i18n/label :t/joined) :label (if joined
(i18n/label :t/pending))}]])) (i18n/label :t/joined)
(i18n/label :t/pending))}]])))
(defn add-handlers (defn- add-handlers
[community-id [community-id
joined-or-spectated joined-or-spectated
{:keys [id locked?] {:keys [id locked?]
:or {locked? false} :or {locked? false}
:as chat}] :as chat}]
(merge (cond-> chat
chat (and (not locked?) id)
(when (and (not locked?) id) (assoc :on-press (when joined-or-spectated
{:on-press (when joined-or-spectated (fn []
(fn [] (rf/dispatch [:dismiss-keyboard])
(rf/dispatch [:dismiss-keyboard]) (debounce/dispatch-and-chill
(debounce/dispatch-and-chill [:communities/navigate-to-community-chat (str community-id id)]
[:communities/navigate-to-community-chat (str community-id id)] 1000)))
1000))) :on-long-press #(rf/dispatch
:on-long-press #(rf/dispatch [:show-bottom-sheet
[:show-bottom-sheet {:content (fn []
{:content (fn [] [chat-actions/actions chat false])}])
[chat-actions/actions chat false])}]) :community-id community-id)))
:community-id community-id})))
(defn add-handlers-to-chats (defn- add-handlers-to-chats
[community-id joined-or-spectated chats] [community-id joined-or-spectated chats]
(mapv (partial add-handlers community-id joined-or-spectated) chats)) (mapv (partial add-handlers community-id joined-or-spectated) chats))
(defn add-handlers-to-categorized-chats (defn- add-handlers-to-categorized-chats
[community-id categorized-chats joined-or-spectated] [community-id categorized-chats joined-or-spectated]
(let [add-on-press (partial add-handlers-to-chats community-id joined-or-spectated)] (let [add-on-press (partial add-handlers-to-chats community-id joined-or-spectated)]
(map (fn [[category v]] (map (fn [[category v]]
[category (update v :chats add-on-press)]) [category (update v :chats add-on-press)])
categorized-chats))) categorized-chats)))
(defn community-header (defn- community-header
[title logo description] [title logo description]
[quo/text-combinations [quo/text-combinations
{:container-style {:container-style
@ -266,11 +236,11 @@
:title-accessibility-label :community-title :title-accessibility-label :community-title
:description-accessibility-label :community-description}]) :description-accessibility-label :community-description}])
(defn community-content (defn- community-content
[community] [{:keys [id]}]
(rf/dispatch [:communities/check-all-community-channels-permissions (:id community)]) (rf/dispatch [:communities/check-all-community-channels-permissions id])
(fn [{:keys [name description joined spectated images tags color id token-permissions] :as community} (fn [{:keys [name description joined spectated images tags color id membership-permissions?]
pending? :as community}
{:keys [on-category-layout {:keys [on-category-layout
collapsed? collapsed?
on-first-channel-height-changed]}] on-first-channel-height-changed]}]
@ -279,7 +249,7 @@
[:<> [:<>
[rn/view {:style style/community-content-container} [rn/view {:style style/community-content-container}
(when-not collapsed? (when-not collapsed?
[status-tag pending? joined]) [status-tag id joined])
[community-header name (when collapsed? (get-in images [:thumbnail :uri])) [community-header name (when collapsed? (get-in images [:thumbnail :uri]))
(when-not collapsed? description)] (when-not collapsed? description)]
(when (and (seq tags) (not collapsed?)) (when (and (seq tags) (not collapsed?))
@ -287,9 +257,8 @@
{:tags tags {:tags tags
:last-item-style style/last-community-tag :last-item-style style/last-community-tag
:container-style style/community-tag-container}]) :container-style style/community-tag-container}])
[join-community community pending?]] [join-community community]]
(when (or (and (seq token-permissions) joined) (when (or joined (not membership-permissions?))
(empty? token-permissions))
[channel-list-component [channel-list-component
{:on-category-layout on-category-layout {:on-category-layout on-category-layout
:community-id id :community-id id
@ -297,7 +266,7 @@
:on-first-channel-height-changed on-first-channel-height-changed} :on-first-channel-height-changed on-first-channel-height-changed}
(add-handlers-to-categorized-chats id chats-by-category joined-or-spectated)])]))) (add-handlers-to-categorized-chats id chats-by-category joined-or-spectated)])])))
(defn sticky-category-header (defn- sticky-category-header
[_] [_]
(fn [{:keys [enabled label]}] (fn [{:keys [enabled label]}]
(when enabled (when enabled
@ -310,7 +279,7 @@
{:chevron :left} {:chevron :left}
label]]))) label]])))
(defn page-nav-right-section-buttons (defn- page-nav-right-section-buttons
[id] [id]
[{:icon-name :i/options [{:icon-name :i/options
:accessibility-label :community-options-for-community :accessibility-label :community-options-for-community
@ -318,7 +287,7 @@
[:show-bottom-sheet [:show-bottom-sheet
{:content (fn [] [options/community-options-bottom-sheet id])}])}]) {:content (fn [] [options/community-options-bottom-sheet id])}])}])
(defn pick-first-category-by-height (defn- pick-first-category-by-height
[scroll-height first-channel-height categories-heights] [scroll-height first-channel-height categories-heights]
(->> categories-heights (->> categories-heights
(sort-by (comp - second)) (sort-by (comp - second))
@ -326,7 +295,7 @@
(and (>= scroll-height (+ height first-channel-height)) (and (>= scroll-height (+ height first-channel-height))
category))))) category)))))
(defn community-scroll-page (defn- community-scroll-page
[{:keys [joined]}] [{:keys [joined]}]
(let [scroll-height (reagent/atom 0) (let [scroll-height (reagent/atom 0)
categories-heights (reagent/atom {}) categories-heights (reagent/atom {})
@ -336,7 +305,7 @@
;; from not collapsed to collapsed if the ;; from not collapsed to collapsed if the
;; user is on this page ;; user is on this page
initial-joined? joined] initial-joined? joined]
(fn [{:keys [id name images] :as community} pending?] (fn [{:keys [id name images] :as community}]
(let [cover {:uri (get-in images [:banner :uri])} (let [cover {:uri (get-in images [:banner :uri])}
logo {:uri (get-in images [:thumbnail :uri])} logo {:uri (get-in images [:thumbnail :uri])}
collapsed? (and initial-joined? (:joined community)) collapsed? (and initial-joined? (:joined community))
@ -363,7 +332,6 @@
@categories-heights)}]} @categories-heights)}]}
[community-content [community-content
community community
pending?
{:on-category-layout (partial add-category-height categories-heights) {:on-category-layout (partial add-category-height categories-heights)
:collapsed? collapsed? :collapsed? collapsed?
:on-first-channel-height-changed :on-first-channel-height-changed
@ -373,17 +341,16 @@
(swap! categories-heights select-keys categories) (swap! categories-heights select-keys categories)
(reset! first-channel-height height))}]])))) (reset! first-channel-height height))}]]))))
(defn community-card-page-view (defn- community-card-page-view
[id] [id]
(let [{:keys [id joined] (let [{:keys [id joined]
:as community} (rf/sub [:communities/community id]) :as community} (rf/sub [:communities/community id])]
pending? (rf/sub [:communities/my-pending-request-to-join id])]
(when community (when community
(when joined (when joined
(rf/dispatch [:activity-center.notifications/dismiss-community-overview id])) (rf/dispatch [:activity-center.notifications/dismiss-community-overview id]))
[community-scroll-page community pending?]))) [community-scroll-page community])))
(defn overview (defn view
[id] [id]
(let [id (or id (rf/sub [:get-screen-params :community-overview])) (let [id (or id (rf/sub [:get-screen-params :community-overview]))
customization-color (rf/sub [:profile/customization-color])] customization-color (rf/sub [:profile/customization-color])]

View File

@ -15,7 +15,7 @@
(def screens-map (def screens-map
{shell.constants/chat-screen chat/chat {shell.constants/chat-screen chat/chat
shell.constants/community-screen communities.overview/overview shell.constants/community-screen communities.overview/view
shell.constants/discover-communities-screen communities.discover/view}) shell.constants/discover-communities-screen communities.discover/view})
(defn f-screen (defn f-screen

View File

@ -143,7 +143,7 @@
:component communities.discover/view} :component communities.discover/view}
{:name :community-overview {:name :community-overview
:component communities.overview/overview} :component communities.overview/view}
{:name :settings {:name :settings
:options options/transparent-screen-options :options options/transparent-screen-options

View File

@ -1,6 +1,7 @@
(ns status-im.subs.communities (ns status-im.subs.communities
(:require (:require
[clojure.string :as string] [clojure.string :as string]
[legacy.status-im.data-store.communities :as data-store]
[legacy.status-im.ui.screens.profile.visibility-status.utils :as visibility-status-utils] [legacy.status-im.ui.screens.profile.visibility-status.utils :as visibility-status-utils]
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[status-im.constants :as constants] [status-im.constants :as constants]
@ -307,10 +308,6 @@
[(re-frame/subscribe [:communities/community community-id])]) [(re-frame/subscribe [:communities/community community-id])])
(fn [[{:keys [token-permissions-check token-permissions checking-permissions? token-images]}] _] (fn [[{:keys [token-permissions-check token-permissions checking-permissions? token-images]}] _]
(let [can-request-access? (:satisfied token-permissions-check) (let [can-request-access? (:satisfied token-permissions-check)
role-permissions #{constants/community-token-permission-become-admin
constants/community-token-permission-become-member
constants/community-token-permission-become-token-master
constants/community-token-permission-become-token-owner}
highest-permission-role highest-permission-role
(when can-request-access? (when can-request-access?
(->> token-permissions-check (->> token-permissions-check
@ -321,7 +318,7 @@
(and (first criteria) (and (first criteria)
(some #{(:type (permission-id->permission-value token-permissions (some #{(:type (permission-id->permission-value token-permissions
permission-id))} permission-id))}
role-permissions))] constants/community-role-permissions))]
(if highest-permission-role (if highest-permission-role
(min highest-permission-role permission-type) (min highest-permission-role permission-type)
permission-type) permission-type)
@ -339,8 +336,8 @@
(:permissions token-permissions-check)) (:permissions token-permissions-check))
:tokens (->> :tokens (->>
token-permissions token-permissions
(filter (fn [[_ {:keys [type]}]] (filter (fn [[_ permission]]
(= type constants/community-token-permission-become-member))) (data-store/role-permission? permission)))
(map (fn [[perm-key {:keys [token_criteria]}]] (map (fn [[perm-key {:keys [token_criteria]}]]
(let [check-criteria (get-in token-permissions-check (let [check-criteria (get-in token-permissions-check
[:permissions perm-key :criteria])] [:permissions perm-key :criteria])]

View File

@ -455,7 +455,11 @@
(swap! rf-db/app-db assoc-in [:communities community-id] community) (swap! rf-db/app-db assoc-in [:communities community-id] community)
(is (match? {:can-request-access? true (is (match? {:can-request-access? true
:number-of-hold-tokens 2 :number-of-hold-tokens 2
:tokens [[{:symbol "ETH" :tokens [[{:symbol "DAI"
:amount "5.0"
:sufficient? nil
:loading? checking-permissions?}]
[{:symbol "ETH"
:amount "0.001" :amount "0.001"
:sufficient? nil :sufficient? nil
:loading? checking-permissions? :loading? checking-permissions?