Skip to content

Commit

Permalink
Display private permissions only when the requirements are met
Browse files Browse the repository at this point in the history
  • Loading branch information
ajayesivan committed Apr 16, 2024
1 parent 61974da commit b248c15
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/status_im/subs/communities.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,12 @@
:amount (money/to-fixed (money/token->unit amount-in-wei decimals))
:img-src (get token-images sym)}))

(defn visible-criteria
[criteria]
(filter (fn [{:keys [isPrivate criteria]}]
(or (not isPrivate) (every? identity criteria)))
criteria))

(re-frame/reg-sub
:communities/checking-permissions-by-id
:<- [:communities/permissions-check]
Expand Down Expand Up @@ -368,8 +374,8 @@
checking?
token-images)
tokenRequirement))
(or (:criteria highest-role)
(:criteria lowest-role)))})))
(visible-criteria (or (:criteria highest-role)
(:criteria lowest-role))))})))

(re-frame/reg-sub
:community/images
Expand Down Expand Up @@ -414,7 +420,7 @@
checking?
token-images)
tokenRequirement))
(:criteria role))})
(visible-criteria (:criteria role)))})
member-and-satisifed-roles))))

(re-frame/reg-sub
Expand Down

0 comments on commit b248c15

Please sign in to comment.