Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method for fast creation of communities #16806

Merged
merged 3 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.e2e
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ DELETE_MESSAGE_ENABLED=1
TWO_MINUTES_SYNCING=1
STICKERS_TEST_ENABLED=1
LOCAL_PAIRING_ENABLED=1
FAST_CREATE_COMMUNITY_ENABLED=1
1 change: 1 addition & 0 deletions .env.jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ TWO_MINUTES_SYNCING=1
ENABLE_QUO_PREVIEW=1
STICKERS_TEST_ENABLED=1
LOCAL_PAIRING_ENABLED=1
FAST_CREATE_COMMUNITY_ENABLED=1
1 change: 1 addition & 0 deletions .env.nightly
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ BLANK_PREVIEW=0
COMMUNITIES_ENABLED=1
DATABASE_MANAGEMENT_ENABLED=1
DELETE_MESSAGE_ENABLED=1
FAST_CREATE_COMMUNITY_ENABLED=0
30 changes: 30 additions & 0 deletions src/status_im/communities/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,36 @@
{:db (assoc db :communities/create {:membership constants/community-no-membership-access})}
(navigation/navigate-to :community-create nil)))

(rf/defn create-closed-community
{:events [:fast-create-community/create-closed-community]}
[_]
{:json-rpc/call [{:method "wakuext_createClosedCommunity"
:params []
:js-response true
:on-success #(rf/dispatch [:sanitize-messages-and-process-response %])
:on-error #(log/error "failed to create closed community." {:error %})}]
:dispatch [:hide-bottom-sheet]})

(rf/defn create-open-community
{:events [:fast-create-community/create-open-community]}
[_]
{:json-rpc/call [{:method "wakuext_createOpenCommunity"
:params []
:js-response true
:on-success #(rf/dispatch [:sanitize-messages-and-process-response %])
:on-error #(log/error "failed to create open community." {:error %})}]
:dispatch [:hide-bottom-sheet]})

(rf/defn create-token-gated-community
{:events [:fast-create-community/create-token-gated-community]}
[_]
{:json-rpc/call [{:method "wakuext_createTokenGatedCommunity"
:params []
:js-response true
:on-success #(rf/dispatch [:sanitize-messages-and-process-response %])
:on-error #(log/error "failed to create token gated community." {:error %})}]
:dispatch [:hide-bottom-sheet]})

(rf/defn open-edit-community
{:events [::open-edit-community :communities/open-edit-community]}
[{:keys [db] :as cofx} id]
Expand Down
3 changes: 3 additions & 0 deletions src/status_im2/config.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
(get-config :VERIFY_ENS_CONTRACT_ADDRESS
((ethereum/chain-id->chain-keyword verify-ens-chain-id) ens/ens-registries)))

(def fast-create-community-enabled?
(enabled? (get-config :FAST_CREATE_COMMUNITY_ENABLED "0")))

(def default-multiaccount
{:preview-privacy? blank-preview?
:wallet/visible-tokens {:mainnet #{:SNT}}
Expand Down
33 changes: 24 additions & 9 deletions src/status_im2/contexts/communities/actions/home_plus/view.cljs
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
(ns status-im2.contexts.communities.actions.home-plus.view
(:require [quo2.core :as quo]
[utils.re-frame :as rf]))
[utils.re-frame :as rf]
[status-im2.config :as config]))

(defn view
[]
[quo/action-drawer
[[{:icon :i/download
:accessibility-label :import-community
:label "Import community"
:on-press #(rf/dispatch [:navigate-to :community-import])}
{:icon :i/communities
:accessibility-label :create-community
:label "Create community (only for e2e)"
:on-press #(rf/dispatch [:legacy-only-for-e2e/open-create-community])}]]])
[(concat [{:icon :i/download
:accessibility-label :import-community
:label "Import community"
:on-press #(rf/dispatch [:navigate-to :community-import])}
{:icon :i/communities
:accessibility-label :create-community
:label "Create community (only for e2e)"
:on-press #(rf/dispatch [:legacy-only-for-e2e/open-create-community])}]
(when config/fast-create-community-enabled?
[{:icon :i/communities
:accessibility-label :create-closed-community
:label "Create closed community"
:on-press #(rf/dispatch [:fast-create-community/create-closed-community])}
{:icon :i/communities
:accessibility-label :create-open-community
:label "Create open community"
:on-press #(rf/dispatch [:fast-create-community/create-open-community])}
{:icon :i/communities
:accessibility-label :create-token-gated-community
:label "Create token-gated community"
:on-press #(rf/dispatch
[:fast-create-community/create-token-gated-community])}]))]])
6 changes: 3 additions & 3 deletions status-go-version.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
"owner": "status-im",
"repo": "status-go",
"version": "v0.162.13",
"commit-sha1": "b81ad3fcac4c8c5c24964fb9f62dedc020ec3eb5",
"src-sha256": "0w69rdpaqm88wa9yxkdg46iw7cvd8aln1c3znzph2wf0803ab1qm"
"version": "v0.162.14",
"commit-sha1": "60143556ff942e24f4641dc741049e8ad4fef619",
"src-sha256": "0b8rk8v9fmsf36611c3frzdgq6y09pzy83h4zbz50fccphzrcxcf"
}