fix: Community state cannot be changed to failed to fetch (#20101)
Signed-off-by: yqrashawn <namy.19@gmail.com>
This commit is contained in:
parent
389a730eff
commit
b358c06a31
|
@ -241,6 +241,13 @@
|
|||
|
||||
(rf/reg-event-fx :chat.ui/community-failed-to-fetch community-failed-to-fetch)
|
||||
|
||||
(defn- failed-to-fetch-community
|
||||
[community-id err]
|
||||
(rf/dispatch [:chat.ui/community-failed-to-fetch community-id])
|
||||
(log/error {:message
|
||||
"Failed to request community info from mailserver"
|
||||
:error err}))
|
||||
|
||||
(defn fetch-community
|
||||
[{:keys [db]} [{:keys [community-id update-last-opened-at?]}]]
|
||||
(when (and community-id (not (get-in db [:communities/fetching-communities community-id])))
|
||||
|
@ -250,14 +257,16 @@
|
|||
:TryDatabase true
|
||||
:WaitForResponse true}]
|
||||
:on-success (fn [community]
|
||||
(when update-last-opened-at?
|
||||
(rf/dispatch [:communities/update-last-opened-at community-id]))
|
||||
(rf/dispatch [:chat.ui/community-fetched community-id community]))
|
||||
:on-error (fn [err]
|
||||
(rf/dispatch [:chat.ui/community-failed-to-fetch community-id])
|
||||
(log/error {:message
|
||||
"Failed to request community info from mailserver"
|
||||
:error err}))}]}))
|
||||
(if community
|
||||
(do (when update-last-opened-at?
|
||||
(rf/dispatch [:communities/update-last-opened-at
|
||||
community-id]))
|
||||
(rf/dispatch [:chat.ui/community-fetched community-id
|
||||
community]))
|
||||
(failed-to-fetch-community
|
||||
community-id
|
||||
"community wasn't found at the store node")))
|
||||
:on-error (partial failed-to-fetch-community community-id)}]}))
|
||||
|
||||
(schema/=> fetch-community
|
||||
[:=>
|
||||
|
|
Loading…
Reference in New Issue