Skip to content

Commit

Permalink
fix: join open community notification
Browse files Browse the repository at this point in the history
  • Loading branch information
jo-mut committed Aug 15, 2023
1 parent 05889b7 commit 5c56f54
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@
[utils.requests :as requests]))

(defn request-to-join-text
[open?]
[open? node-offline?]
(if open?
(i18n/label :t/join-open-community)
(cond
node-offline?
(i18n/label :t/request-to-join)

(not node-offline?)
(i18n/label :t/join-open-community))
(i18n/label :t/request-to-join)))

(defn request-to-join
Expand All @@ -24,10 +29,12 @@
id
images
can-join?
joined
can-request-access?
requested-to-join-at]} (rf/sub [:get-screen-params])
pending? (rf/sub [:communities/my-pending-request-to-join id])
open? (not= 3 (:access permissions))]
open? (not= 3 (:access permissions))
node-offline? (and can-join? (not joined) pending?)]
[rn/view {:flex 1}
[gesture/scroll-view {:style {:flex 1}}
[rn/view style/page-container
Expand All @@ -36,7 +43,7 @@
{:accessibility-label :communities-join-community
:weight :semi-bold
:size :heading-1}
(request-to-join-text open?)]]
(request-to-join-text open? node-offline?)]]
[quo/context-tag
{:style
{:margin-right :auto
Expand Down Expand Up @@ -77,7 +84,7 @@
(rf/dispatch [:navigate-back]))))
:disabled? (not @agreed-to-rules?)
:container-style {:flex 1}}
(request-to-join-text open?)]]
(request-to-join-text open? node-offline?)]]
[rn/view {:style style/final-disclaimer-container}
[quo/text
{:size :paragraph-2
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 5c56f54

Please sign in to comment.