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
This commit is contained in:
frank 2023-08-03 08:59:28 +08:00 committed by GitHub
parent 049e958992
commit 7b425c1a53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 63 additions and 12 deletions

View File

@ -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

View File

@ -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

View File

@ -21,3 +21,4 @@ BLANK_PREVIEW=0
COMMUNITIES_ENABLED=1
DATABASE_MANAGEMENT_ENABLED=1
DELETE_MESSAGE_ENABLED=1
FAST_CREATE_COMMUNITY_ENABLED=0

View File

@ -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]

View File

@ -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}}

View File

@ -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])}]))]])

View File

@ -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"
}