Skip to content

Commit 7b425c1

Browse files
authored
Add method for fast creation of communities (#16806)
* fast create community to test * fix: in PR builds only token gated community is available * update status-go-version.json
1 parent 049e958 commit 7b425c1

File tree

7 files changed

+63
-12
lines changed

7 files changed

+63
-12
lines changed

.env.e2e

+1
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ DELETE_MESSAGE_ENABLED=1
3232
TWO_MINUTES_SYNCING=1
3333
STICKERS_TEST_ENABLED=1
3434
LOCAL_PAIRING_ENABLED=1
35+
FAST_CREATE_COMMUNITY_ENABLED=1

.env.jenkins

+1
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@ TWO_MINUTES_SYNCING=1
3434
ENABLE_QUO_PREVIEW=1
3535
STICKERS_TEST_ENABLED=1
3636
LOCAL_PAIRING_ENABLED=1
37+
FAST_CREATE_COMMUNITY_ENABLED=1

.env.nightly

+1
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ BLANK_PREVIEW=0
2121
COMMUNITIES_ENABLED=1
2222
DATABASE_MANAGEMENT_ENABLED=1
2323
DELETE_MESSAGE_ENABLED=1
24+
FAST_CREATE_COMMUNITY_ENABLED=0

src/status_im/communities/core.cljs

+30
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,36 @@
532532
{:db (assoc db :communities/create {:membership constants/community-no-membership-access})}
533533
(navigation/navigate-to :community-create nil)))
534534

535+
(rf/defn create-closed-community
536+
{:events [:fast-create-community/create-closed-community]}
537+
[_]
538+
{:json-rpc/call [{:method "wakuext_createClosedCommunity"
539+
:params []
540+
:js-response true
541+
:on-success #(rf/dispatch [:sanitize-messages-and-process-response %])
542+
:on-error #(log/error "failed to create closed community." {:error %})}]
543+
:dispatch [:hide-bottom-sheet]})
544+
545+
(rf/defn create-open-community
546+
{:events [:fast-create-community/create-open-community]}
547+
[_]
548+
{:json-rpc/call [{:method "wakuext_createOpenCommunity"
549+
:params []
550+
:js-response true
551+
:on-success #(rf/dispatch [:sanitize-messages-and-process-response %])
552+
:on-error #(log/error "failed to create open community." {:error %})}]
553+
:dispatch [:hide-bottom-sheet]})
554+
555+
(rf/defn create-token-gated-community
556+
{:events [:fast-create-community/create-token-gated-community]}
557+
[_]
558+
{:json-rpc/call [{:method "wakuext_createTokenGatedCommunity"
559+
:params []
560+
:js-response true
561+
:on-success #(rf/dispatch [:sanitize-messages-and-process-response %])
562+
:on-error #(log/error "failed to create token gated community." {:error %})}]
563+
:dispatch [:hide-bottom-sheet]})
564+
535565
(rf/defn open-edit-community
536566
{:events [::open-edit-community :communities/open-edit-community]}
537567
[{:keys [db] :as cofx} id]

src/status_im2/config.cljs

+3
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@
6868
(get-config :VERIFY_ENS_CONTRACT_ADDRESS
6969
((ethereum/chain-id->chain-keyword verify-ens-chain-id) ens/ens-registries)))
7070

71+
(def fast-create-community-enabled?
72+
(enabled? (get-config :FAST_CREATE_COMMUNITY_ENABLED "0")))
73+
7174
(def default-multiaccount
7275
{:preview-privacy? blank-preview?
7376
:wallet/visible-tokens {:mainnet #{:SNT}}
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
11
(ns status-im2.contexts.communities.actions.home-plus.view
22
(:require [quo2.core :as quo]
3-
[utils.re-frame :as rf]))
3+
[utils.re-frame :as rf]
4+
[status-im2.config :as config]))
45

56
(defn view
67
[]
78
[quo/action-drawer
8-
[[{:icon :i/download
9-
:accessibility-label :import-community
10-
:label "Import community"
11-
:on-press #(rf/dispatch [:navigate-to :community-import])}
12-
{:icon :i/communities
13-
:accessibility-label :create-community
14-
:label "Create community (only for e2e)"
15-
:on-press #(rf/dispatch [:legacy-only-for-e2e/open-create-community])}]]])
9+
[(concat [{:icon :i/download
10+
:accessibility-label :import-community
11+
:label "Import community"
12+
:on-press #(rf/dispatch [:navigate-to :community-import])}
13+
{:icon :i/communities
14+
:accessibility-label :create-community
15+
:label "Create community (only for e2e)"
16+
:on-press #(rf/dispatch [:legacy-only-for-e2e/open-create-community])}]
17+
(when config/fast-create-community-enabled?
18+
[{:icon :i/communities
19+
:accessibility-label :create-closed-community
20+
:label "Create closed community"
21+
:on-press #(rf/dispatch [:fast-create-community/create-closed-community])}
22+
{:icon :i/communities
23+
:accessibility-label :create-open-community
24+
:label "Create open community"
25+
:on-press #(rf/dispatch [:fast-create-community/create-open-community])}
26+
{:icon :i/communities
27+
:accessibility-label :create-token-gated-community
28+
:label "Create token-gated community"
29+
:on-press #(rf/dispatch
30+
[:fast-create-community/create-token-gated-community])}]))]])

status-go-version.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
44
"owner": "status-im",
55
"repo": "status-go",
6-
"version": "v0.162.13",
7-
"commit-sha1": "b81ad3fcac4c8c5c24964fb9f62dedc020ec3eb5",
8-
"src-sha256": "0w69rdpaqm88wa9yxkdg46iw7cvd8aln1c3znzph2wf0803ab1qm"
6+
"version": "v0.162.14",
7+
"commit-sha1": "60143556ff942e24f4641dc741049e8ad4fef619",
8+
"src-sha256": "0b8rk8v9fmsf36611c3frzdgq6y09pzy83h4zbz50fccphzrcxcf"
99
}

0 commit comments

Comments
 (0)