Skip to content

Commit

Permalink
Add members to open community
Browse files Browse the repository at this point in the history
* add members to open community

* fix: join open community notification
  • Loading branch information
jo-mut committed Aug 18, 2023
1 parent 99294fa commit 66e3b60
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
9 changes: 0 additions & 9 deletions src/status_im/communities/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,6 @@
(log/error "failed to import community" %)
(re-frame/dispatch [::failed-to-import %]))}]})

(rf/defn join
{:events [:communities/join]}
[_ community-id]
{:json-rpc/call [{:method "wakuext_joinCommunity"
:params [community-id]
:js-response true
:on-success #(re-frame/dispatch [::joined %])
:on-error #(log/error "failed to join community" community-id %)}]})

(rf/defn request-to-join
{:events [:communities/request-to-join]}
[_ community-id]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
:on-press (fn []
(if can-join?
(do
(rf/dispatch [:communities/join id])
(rf/dispatch [:communities/request-to-join id])
(rf/dispatch [:navigate-back]))
(do (and can-request-access?
(not pending?)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
(defn- get-header-text-and-context
[community membership-status]
(let [community-name (:name community)
permissions (:permissions community)
community-image (get-in community [:images :thumbnail :uri])
community-context-tag [quo/context-tag common/tag-params community-image
community-name]]
community-name]
open? (not= 3 (:access permissions))]
(cond
(= membership-status constants/activity-center-membership-status-idle)
{:header-text (i18n/label :t/community-request-not-accepted)
Expand All @@ -40,9 +42,14 @@
community-context-tag]}

(= membership-status constants/activity-center-membership-status-accepted)
{:header-text (i18n/label :t/community-request-accepted)
{:header-text (i18n/label (if open?
:t/join-open-community
:t/community-request-accepted))
:context [[quo/text {:style common-style/user-avatar-tag-text}
(i18n/label :t/community-request-accepted-body-text)]
(i18n/label (if open?
:t/joined-community
:t/community-request-accepted-body-text)
(when open? {:community community-name}))]
community-context-tag]}

:else nil)))
Expand Down
1 change: 1 addition & 0 deletions translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@
"communities-verified": "✓ Verified Status Community",
"communities-enabled": "Communities enabled",
"request-access": "Request access",
"requesting": "Requesting",
"membership-request-pending": "Membership request pending",
"create-community": "Create a community",
"create-category": "Create category",
Expand Down

0 comments on commit 66e3b60

Please sign in to comment.