* Fix not joined drawer options for token gated communities * Remove `show-not-implemented-features?` flag for token gated options * Fix component tests
This commit is contained in:
parent
6464ef96b6
commit
f606dc065b
|
@ -8,7 +8,8 @@
|
||||||
|
|
||||||
(h/test "joined options - Non token Gated"
|
(h/test "joined options - Non token Gated"
|
||||||
(h/setup-subs {:communities/my-pending-request-to-join nil
|
(h/setup-subs {:communities/my-pending-request-to-join nil
|
||||||
:communities/community {:joined true}})
|
:communities/community {:joined true}
|
||||||
|
:profile/test-networks-enabled? false})
|
||||||
(h/render [options/community-options-bottom-sheet {:id "test"}])
|
(h/render [options/community-options-bottom-sheet {:id "test"}])
|
||||||
(h/is-truthy (h/get-by-translation-text :t/view-members))
|
(h/is-truthy (h/get-by-translation-text :t/view-members))
|
||||||
(h/is-truthy (h/get-by-translation-text :t/view-community-rules))
|
(h/is-truthy (h/get-by-translation-text :t/view-community-rules))
|
||||||
|
@ -23,7 +24,8 @@
|
||||||
(h/test "joined options - Token Gated"
|
(h/test "joined options - Token Gated"
|
||||||
(h/setup-subs {:communities/my-pending-request-to-join nil
|
(h/setup-subs {:communities/my-pending-request-to-join nil
|
||||||
:communities/community {:joined true
|
:communities/community {:joined true
|
||||||
:role-permissions? true}})
|
:role-permissions? true}
|
||||||
|
:profile/test-networks-enabled? false})
|
||||||
(h/render [options/community-options-bottom-sheet {:id "test"}])
|
(h/render [options/community-options-bottom-sheet {:id "test"}])
|
||||||
(h/is-truthy (h/get-by-translation-text :t/view-members))
|
(h/is-truthy (h/get-by-translation-text :t/view-members))
|
||||||
(h/is-truthy (h/get-by-translation-text :t/view-community-rules))
|
(h/is-truthy (h/get-by-translation-text :t/view-community-rules))
|
||||||
|
@ -38,7 +40,8 @@
|
||||||
|
|
||||||
(h/test "admin options - Non token Gated"
|
(h/test "admin options - Non token Gated"
|
||||||
(h/setup-subs {:communities/my-pending-request-to-join nil
|
(h/setup-subs {:communities/my-pending-request-to-join nil
|
||||||
:communities/community {:admin true}})
|
:communities/community {:admin true}
|
||||||
|
:profile/test-networks-enabled? false})
|
||||||
(h/render [options/community-options-bottom-sheet {:id "test"}])
|
(h/render [options/community-options-bottom-sheet {:id "test"}])
|
||||||
(h/is-truthy (h/get-by-translation-text :t/view-members))
|
(h/is-truthy (h/get-by-translation-text :t/view-members))
|
||||||
(h/is-truthy (h/get-by-translation-text :t/view-community-rules))
|
(h/is-truthy (h/get-by-translation-text :t/view-community-rules))
|
||||||
|
@ -52,7 +55,8 @@
|
||||||
(h/test "admin options - Token Gated"
|
(h/test "admin options - Token Gated"
|
||||||
(h/setup-subs {:communities/my-pending-request-to-join nil
|
(h/setup-subs {:communities/my-pending-request-to-join nil
|
||||||
:communities/community {:admin true
|
:communities/community {:admin true
|
||||||
:role-permissions? true}})
|
:role-permissions? true}
|
||||||
|
:profile/test-networks-enabled? false})
|
||||||
(h/render [options/community-options-bottom-sheet {:id "test"}])
|
(h/render [options/community-options-bottom-sheet {:id "test"}])
|
||||||
(h/is-truthy (h/get-by-translation-text :t/view-members))
|
(h/is-truthy (h/get-by-translation-text :t/view-members))
|
||||||
(h/is-truthy (h/get-by-translation-text :t/view-community-rules))
|
(h/is-truthy (h/get-by-translation-text :t/view-community-rules))
|
||||||
|
@ -65,7 +69,8 @@
|
||||||
|
|
||||||
(h/test "request sent options - Non token Gated"
|
(h/test "request sent options - Non token Gated"
|
||||||
(h/setup-subs {:communities/my-pending-request-to-join "mock-id"
|
(h/setup-subs {:communities/my-pending-request-to-join "mock-id"
|
||||||
:communities/community {}})
|
:communities/community {}
|
||||||
|
:profile/test-networks-enabled? false})
|
||||||
(h/render [options/community-options-bottom-sheet {:id "test"}])
|
(h/render [options/community-options-bottom-sheet {:id "test"}])
|
||||||
(h/is-truthy (h/get-by-translation-text :t/view-members))
|
(h/is-truthy (h/get-by-translation-text :t/view-members))
|
||||||
(h/is-truthy (h/get-by-translation-text :t/view-community-rules))
|
(h/is-truthy (h/get-by-translation-text :t/view-community-rules))
|
||||||
|
@ -76,7 +81,8 @@
|
||||||
|
|
||||||
(h/test "request sent options - Token Gated"
|
(h/test "request sent options - Token Gated"
|
||||||
(h/setup-subs {:communities/my-pending-request-to-join "mock-id"
|
(h/setup-subs {:communities/my-pending-request-to-join "mock-id"
|
||||||
:communities/community {:role-permissions? true}})
|
:communities/community {:role-permissions? true}
|
||||||
|
:profile/test-networks-enabled? false})
|
||||||
(h/render [options/community-options-bottom-sheet {:id "test"}])
|
(h/render [options/community-options-bottom-sheet {:id "test"}])
|
||||||
(h/is-truthy (h/get-by-translation-text :t/invite-people-from-contacts))
|
(h/is-truthy (h/get-by-translation-text :t/invite-people-from-contacts))
|
||||||
;(h/is-truthy (h/get-by-translation-text :t/view-token-gating))
|
;(h/is-truthy (h/get-by-translation-text :t/view-token-gating))
|
||||||
|
@ -86,7 +92,8 @@
|
||||||
|
|
||||||
(h/test "banned options - Non token Gated"
|
(h/test "banned options - Non token Gated"
|
||||||
(h/setup-subs {:communities/my-pending-request-to-join nil
|
(h/setup-subs {:communities/my-pending-request-to-join nil
|
||||||
:communities/community {:banList true}})
|
:communities/community {:banList true}
|
||||||
|
:profile/test-networks-enabled? false})
|
||||||
(h/render [options/community-options-bottom-sheet {:id "test"}])
|
(h/render [options/community-options-bottom-sheet {:id "test"}])
|
||||||
(h/is-truthy (h/get-by-translation-text :t/view-members))
|
(h/is-truthy (h/get-by-translation-text :t/view-members))
|
||||||
(h/is-truthy (h/get-by-translation-text :t/view-community-rules))
|
(h/is-truthy (h/get-by-translation-text :t/view-community-rules))
|
||||||
|
@ -97,7 +104,8 @@
|
||||||
(h/test "banned options - Token Gated"
|
(h/test "banned options - Token Gated"
|
||||||
(h/setup-subs {:communities/my-pending-request-to-join nil
|
(h/setup-subs {:communities/my-pending-request-to-join nil
|
||||||
:communities/community {:banList 100
|
:communities/community {:banList 100
|
||||||
:role-permissions? true}})
|
:role-permissions? true}
|
||||||
|
:profile/test-networks-enabled? false})
|
||||||
(h/render [options/community-options-bottom-sheet {:id "test"}])
|
(h/render [options/community-options-bottom-sheet {:id "test"}])
|
||||||
(h/is-truthy (h/get-by-translation-text :t/invite-people-from-contacts))
|
(h/is-truthy (h/get-by-translation-text :t/invite-people-from-contacts))
|
||||||
;(h/is-truthy (h/get-by-translation-text :t/view-token-gating))
|
;(h/is-truthy (h/get-by-translation-text :t/view-token-gating))
|
||||||
|
@ -107,7 +115,8 @@
|
||||||
(h/test "banned options - Token Gated"
|
(h/test "banned options - Token Gated"
|
||||||
(h/setup-subs {:communities/my-pending-request-to-join nil
|
(h/setup-subs {:communities/my-pending-request-to-join nil
|
||||||
:communities/community {:banList 100
|
:communities/community {:banList 100
|
||||||
:role-permissions? true}})
|
:role-permissions? true}
|
||||||
|
:profile/test-networks-enabled? false})
|
||||||
(h/render [options/community-options-bottom-sheet {:id "test"}])
|
(h/render [options/community-options-bottom-sheet {:id "test"}])
|
||||||
(h/is-truthy (h/get-by-translation-text :t/invite-people-from-contacts))
|
(h/is-truthy (h/get-by-translation-text :t/invite-people-from-contacts))
|
||||||
;(h/is-truthy (h/get-by-translation-text :t/view-token-gating))
|
;(h/is-truthy (h/get-by-translation-text :t/view-token-gating))
|
||||||
|
@ -118,6 +127,7 @@
|
||||||
(h/setup-subs {:communities/my-pending-request-to-join nil
|
(h/setup-subs {:communities/my-pending-request-to-join nil
|
||||||
:communities/community {:joined true
|
:communities/community {:joined true
|
||||||
:muted true
|
:muted true
|
||||||
:role-permissions? true}})
|
:role-permissions? true}
|
||||||
|
:profile/test-networks-enabled? false})
|
||||||
(h/render [options/community-options-bottom-sheet {:id "test"}])
|
(h/render [options/community-options-bottom-sheet {:id "test"}])
|
||||||
(h/is-truthy (h/get-by-translation-text :t/unmute-community))))
|
(h/is-truthy (h/get-by-translation-text :t/unmute-community))))
|
||||||
|
|
|
@ -36,14 +36,13 @@
|
||||||
|
|
||||||
(defn view-token-gating
|
(defn view-token-gating
|
||||||
[id]
|
[id]
|
||||||
(when config/show-not-implemented-features?
|
{:icon :i/token
|
||||||
{:icon :i/token
|
:right-icon :i/chevron-right
|
||||||
:right-icon :i/chevron-right
|
:accessibility-label :view-token-gating
|
||||||
:accessibility-label :view-token-gating
|
:on-press #(rf/dispatch [:show-bottom-sheet
|
||||||
:on-press #(rf/dispatch [:show-bottom-sheet
|
{:content (fn [] [permissions-sheet/view id])
|
||||||
{:content (fn [] [permissions-sheet/view id])
|
:padding-bottom-override 16}])
|
||||||
:padding-bottom-override 16}])
|
:label (i18n/label :t/view-token-gating)})
|
||||||
:label (i18n/label :t/view-token-gating)}))
|
|
||||||
|
|
||||||
(defn edit-shared-addresses
|
(defn edit-shared-addresses
|
||||||
[id]
|
[id]
|
||||||
|
@ -56,7 +55,7 @@
|
||||||
|
|
||||||
(defn mark-as-read
|
(defn mark-as-read
|
||||||
[id]
|
[id]
|
||||||
{:icon :i/up-to-date
|
{:icon :i/mark-as-read
|
||||||
:accessibility-label :mark-as-read
|
:accessibility-label :mark-as-read
|
||||||
:label (i18n/label :t/mark-as-read)
|
:label (i18n/label :t/mark-as-read)
|
||||||
:on-press #(hide-sheet-and-dispatch [:chat.ui/mark-all-read-in-community-pressed id])})
|
:on-press #(hide-sheet-and-dispatch [:chat.ui/mark-all-read-in-community-pressed id])})
|
||||||
|
@ -136,23 +135,27 @@
|
||||||
request-id])}])})
|
request-id])}])})
|
||||||
|
|
||||||
(defn not-joined-options
|
(defn not-joined-options
|
||||||
[id token-gated? intro-message]
|
[id token-gated? intro-message test-networks-enabled?]
|
||||||
[[(when-not token-gated? (view-members id))
|
(let [common [(show-qr id) (share-community id)]
|
||||||
(when-not token-gated? (view-rules id intro-message))
|
specific (cond
|
||||||
(mark-as-read id)
|
(and token-gated? (not test-networks-enabled?))
|
||||||
(invite-contacts id)
|
[(invite-contacts id) (view-token-gating id)]
|
||||||
(when token-gated? (view-token-gating id))
|
|
||||||
(show-qr id)
|
token-gated?
|
||||||
(share-community id)]])
|
[(invite-contacts id)]
|
||||||
|
|
||||||
|
(not token-gated?)
|
||||||
|
[(view-members id) (view-rules id intro-message) (invite-contacts id)])]
|
||||||
|
[(concat specific common)]))
|
||||||
|
|
||||||
(defn join-request-sent-options
|
(defn join-request-sent-options
|
||||||
[id token-gated? request-id intro-message]
|
[id token-gated? request-id intro-message test-networks-enabled?]
|
||||||
[(conj (first (not-joined-options id token-gated? intro-message))
|
[(conj (first (not-joined-options id token-gated? intro-message test-networks-enabled?))
|
||||||
(assoc (cancel-request-to-join id request-id) :add-divider? true))])
|
(assoc (cancel-request-to-join id request-id) :add-divider? true))])
|
||||||
|
|
||||||
(defn banned-options
|
(defn banned-options
|
||||||
[id token-gated? intro-message]
|
[id token-gated? intro-message test-networks-enabled?]
|
||||||
(not-joined-options id token-gated? intro-message))
|
(not-joined-options id token-gated? intro-message test-networks-enabled?))
|
||||||
|
|
||||||
(defn joined-options
|
(defn joined-options
|
||||||
[id token-gated? muted? muted-till color intro-message]
|
[id token-gated? muted? muted-till color intro-message]
|
||||||
|
@ -186,13 +189,19 @@
|
||||||
(let [{:keys [role-permissions? admin joined
|
(let [{:keys [role-permissions? admin joined
|
||||||
muted banList muted-till color
|
muted banList muted-till color
|
||||||
intro-message]} (rf/sub [:communities/community id])
|
intro-message]} (rf/sub [:communities/community id])
|
||||||
request-id (rf/sub [:communities/my-pending-request-to-join id])]
|
request-id (rf/sub [:communities/my-pending-request-to-join id])
|
||||||
|
test-networks? (rf/sub [:profile/test-networks-enabled?])]
|
||||||
(cond
|
(cond
|
||||||
admin (owner-options id role-permissions? muted muted-till intro-message)
|
admin
|
||||||
joined (joined-options id role-permissions? muted muted-till color intro-message)
|
(owner-options id role-permissions? muted muted-till intro-message)
|
||||||
request-id (join-request-sent-options id role-permissions? request-id intro-message)
|
joined
|
||||||
banList (banned-options id role-permissions? intro-message)
|
(joined-options id role-permissions? muted muted-till color intro-message)
|
||||||
:else (not-joined-options id role-permissions? intro-message))))
|
request-id
|
||||||
|
(join-request-sent-options id role-permissions? request-id intro-message test-networks?)
|
||||||
|
banList
|
||||||
|
(banned-options id role-permissions? intro-message test-networks?)
|
||||||
|
:else
|
||||||
|
(not-joined-options id role-permissions? intro-message test-networks?))))
|
||||||
|
|
||||||
(defn community-options-bottom-sheet
|
(defn community-options-bottom-sheet
|
||||||
[id]
|
[id]
|
||||||
|
|
Loading…
Reference in New Issue