chore: add old edit option to communities options (#15131)

This commit is contained in:
Jamie Caprani 2023-02-27 13:49:37 +00:00 committed by GitHub
parent 80f063d0dd
commit f84c2ec9f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 12 deletions

View File

@ -427,7 +427,7 @@
(navigation/navigate-to :community-create nil))) (navigation/navigate-to :community-create nil)))
(rf/defn open-edit-community (rf/defn open-edit-community
{:events [::open-edit-community]} {:events [::open-edit-community :communities/open-edit-community]}
[{:keys [db] :as cofx} id] [{:keys [db] :as cofx} id]
(let [{:keys [name description images permissions color]} (get-in db [:communities id]) (let [{:keys [name description images permissions color]} (get-in db [:communities id])
{:keys [access]} permissions] {:keys [access]} permissions]

View File

@ -101,7 +101,8 @@
{:icon :i/edit {:icon :i/edit
:label (i18n/label :t/edit-community) :label (i18n/label :t/edit-community)
:accessibility-label :edit-community :accessibility-label :edit-community
:on-press #(js/alert (str "implement action" id))}) :on-press #(rf/dispatch [:communities/open-edit-community id]
(rf/dispatch [:bottom-sheet/hide]))})
(defn not-joined-options (defn not-joined-options
[id token-gated?] [id token-gated?]
@ -149,18 +150,14 @@
(defn get-context-drawers (defn get-context-drawers
[{:keys [id]}] [{:keys [id]}]
(let [community (rf/sub [:communities/community id]) (let [{:keys [token-gated? admin joined requested-to-join-at
token-gated? (:token-gated? community) muted banList]} (rf/sub [:communities/community id])
joined? (:joined community) request-sent? (pos? requested-to-join-at)]
admin? (:admin community)
request-sent? (pos? (:requested-to-join-at community))
muted? (:muted community)
banned? (:banList community)]
(cond (cond
joined? (joined-options id token-gated? muted?) admin (owner-options id token-gated? muted)
admin? (owner-options id token-gated? muted?) joined (joined-options id token-gated? muted)
request-sent? (join-request-sent-options id token-gated?) request-sent? (join-request-sent-options id token-gated?)
banned? (banned-options id token-gated?) banList (banned-options id token-gated?)
:else (not-joined-options id token-gated?)))) :else (not-joined-options id token-gated?))))
(defn community-options-bottom-sheet (defn community-options-bottom-sheet