2023-12-19 17:41:30 +00:00
|
|
|
(ns legacy.status-im.data-store.communities-test
|
Communities - Token gated community fixes (#17799)
- Fix: when there are only channel token permissions, don't show the text "You
hold 0 of these:" because there are no requirements to show.
- Fix: do not show channel token permissions when the user wants to join a
community. In other words: only "become admin", "become member", "become token
master", and "become token owner" are taken in consideration.
- Fix: render correct channel lock icon in 3 states (no permission, with
permissions and locked and with permissions and unlocked).
- Fix: Previously, before having joined a community, all channels had a lock
icon closed, now the lock icon is only closed when there's a permission set,
otherwise no icon is shown (the lock is never open before the user joins the
community).
- Fix: small UI spacing fix, only display community tags component when there's
at least one tag.
- Bonus fix: community Overview and Discover screens top bar had a regression,
see the screenshots.
Fixes https://github.com/status-im/status-mobile/issues/17267
### Areas that may be impacted
- Community overview, before and after joining a community.
### Steps to test
Code tested using the Goerli network and with the testnet flag enabled in the
Desktop client. Out of scope: minted tokens.
2023-11-09 23:19:26 +00:00
|
|
|
(:require
|
|
|
|
[cljs.test :refer [deftest is]]
|
2023-12-19 17:41:30 +00:00
|
|
|
[legacy.status-im.data-store.communities :as sut]))
|
Communities - Token gated community fixes (#17799)
- Fix: when there are only channel token permissions, don't show the text "You
hold 0 of these:" because there are no requirements to show.
- Fix: do not show channel token permissions when the user wants to join a
community. In other words: only "become admin", "become member", "become token
master", and "become token owner" are taken in consideration.
- Fix: render correct channel lock icon in 3 states (no permission, with
permissions and locked and with permissions and unlocked).
- Fix: Previously, before having joined a community, all channels had a lock
icon closed, now the lock icon is only closed when there's a permission set,
otherwise no icon is shown (the lock is never open before the user joins the
community).
- Fix: small UI spacing fix, only display community tags component when there's
at least one tag.
- Bonus fix: community Overview and Discover screens top bar had a regression,
see the screenshots.
Fixes https://github.com/status-im/status-mobile/issues/17267
### Areas that may be impacted
- Community overview, before and after joining a community.
### Steps to test
Code tested using the Goerli network and with the testnet flag enabled in the
Desktop client. Out of scope: minted tokens.
2023-11-09 23:19:26 +00:00
|
|
|
|
|
|
|
(def permissions
|
|
|
|
{"community-id-chat-1"
|
|
|
|
{:viewOnlyPermissions {:satisfied false
|
|
|
|
:permissions {:token-permission-id-01 {:criteria [false]}}}
|
|
|
|
:viewAndPostPermissions {:satisfied true :permissions {}}}
|
|
|
|
"community-id-chat-2"
|
|
|
|
{:viewOnlyPermissions {:satisfied true :permissions {}}
|
|
|
|
:viewAndPostPermissions {:satisfied true :permissions {}}}})
|
|
|
|
|
|
|
|
(deftest rpc->channel-permissions-test
|
|
|
|
(is (= {"community-id-chat-1"
|
|
|
|
{:view-only {:satisfied? false
|
|
|
|
:permissions {:token-permission-id-01 {:criteria [false]}}}
|
|
|
|
:view-and-post {:satisfied? true :permissions {}}}
|
|
|
|
"community-id-chat-2"
|
|
|
|
{:view-only {:satisfied? true :permissions {}}
|
|
|
|
:view-and-post {:satisfied? true :permissions {}}}}
|
|
|
|
(sut/rpc->channel-permissions permissions))))
|