Show success toast when user joins community. (#17815)

This commit is contained in:
Ibrahem Khalil 2023-11-06 16:22:15 +02:00 committed by GitHub
parent dc571b6067
commit ee019f79f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 3 deletions

View File

@ -94,9 +94,17 @@
(defn- handle-my-request (defn- handle-my-request
[db {:keys [community-id state deleted] :as request}] [db {:keys [community-id state deleted] :as request}]
(if (and (= constants/community-request-to-join-state-pending state) (not deleted)) (let [{:keys [name]} (get-in db [:communities community-id])]
(assoc-in db [:communities/my-pending-requests-to-join community-id] request) (cond (and (= constants/community-request-to-join-state-pending state) (not deleted))
(update-in db [:communities/my-pending-requests-to-join] dissoc community-id))) (assoc-in db [:communities/my-pending-requests-to-join community-id] request)
(and (= constants/community-request-to-join-state-accepted state) (not deleted))
(do (re-frame/dispatch [:toasts/upsert
{:icon :i/correct
:id :joined-community
:icon-color (:positive-01 @colors/theme)
:text (i18n/label :t/joined-community {:community name})}])
(update-in db [:communities/my-pending-requests-to-join] dissoc community-id))
:else (update-in db [:communities/my-pending-requests-to-join] dissoc community-id))))
(defn handle-admin-request (defn handle-admin-request
[db {:keys [id community-id deleted] :as request}] [db {:keys [id community-id deleted] :as request}]