fix: fix mailserver popup showing after canceling it
Fixes #10065 After clicking cancel, the popup is `dismissed`, so it will not appear again Selecting a new mail server sets `dismissed` as false, so the error can appear again
This commit is contained in:
parent
a6e08f0d8e
commit
b2cdc59670
|
@ -220,6 +220,11 @@
|
|||
(fn [cofx [_ current-fleet mailserver-id]]
|
||||
(mailserver/save-settings cofx current-fleet mailserver-id)))
|
||||
|
||||
(handlers/register-handler-fx
|
||||
:mailserver.ui/dismiss-connection-error
|
||||
(fn [cofx [_ new-state]]
|
||||
(mailserver/dismiss-connection-error cofx new-state)))
|
||||
|
||||
(handlers/register-handler-fx
|
||||
:mailserver.ui/unpin-pressed
|
||||
(fn [cofx _]
|
||||
|
|
|
@ -59,6 +59,9 @@
|
|||
(defn preferred-mailserver-id [db]
|
||||
(get-in db [:multiaccount :pinned-mailservers (node/current-fleet-key db)]))
|
||||
|
||||
(defn connection-error-dismissed [db]
|
||||
(get-in db [:mailserver/connection-error-dismissed]))
|
||||
|
||||
(defn mailserver-address->id [db address]
|
||||
(let [current-fleet (node/current-fleet-key db)]
|
||||
(:id (some #(when (= address (:address %))
|
||||
|
@ -526,13 +529,17 @@
|
|||
;; instead of using pos?
|
||||
(not (zero? (:peers-count db))))
|
||||
(if-let [preferred-mailserver (preferred-mailserver-id db)]
|
||||
(let [current-fleet (node/current-fleet-key db)]
|
||||
(let [error-dismissed (connection-error-dismissed db)
|
||||
current-fleet (node/current-fleet-key db)]
|
||||
;; Error connecting to the mail server
|
||||
{:db
|
||||
(update-mailserver-state db :error)
|
||||
:ui/show-confirmation
|
||||
(when-not error-dismissed
|
||||
{:title (i18n/label :t/mailserver-error-title)
|
||||
:content (i18n/label :t/mailserver-error-content)
|
||||
:confirm-button-text (i18n/label :t/mailserver-pick-another)
|
||||
:on-cancel #(re-frame/dispatch [:mailserver.ui/dismiss-connection-error true])
|
||||
:on-accept #(re-frame/dispatch
|
||||
[:navigate-to :offline-messaging-settings])
|
||||
:extra-options [{:text (i18n/label :t/mailserver-retry)
|
||||
|
@ -540,7 +547,7 @@
|
|||
[:mailserver.ui/connect-confirmed
|
||||
current-fleet
|
||||
preferred-mailserver])
|
||||
:style "default"}]}})
|
||||
:style "default"}]})})
|
||||
(let [{:keys [address]} (fetch-current db)]
|
||||
(fx/merge cofx
|
||||
{:mailserver/remove-peer address}
|
||||
|
@ -1133,6 +1140,9 @@
|
|||
(assoc (set-input cofx :url url)
|
||||
:dispatch [:navigate-back]))
|
||||
|
||||
(fx/defn dismiss-connection-error [{:keys [db]} new-state]
|
||||
{:db (assoc db :mailserver/connection-error-dismissed new-state)})
|
||||
|
||||
(fx/defn save-settings
|
||||
[{:keys [db] :as cofx} current-fleet mailserver-id]
|
||||
(let [{:keys [address]} (fetch-current db)
|
||||
|
@ -1143,9 +1153,8 @@
|
|||
(fx/merge cofx
|
||||
{:db (assoc db :mailserver/current-id mailserver-id)
|
||||
:mailserver/remove-peer address}
|
||||
|
||||
(when use-mailservers? (connect-to-mailserver))
|
||||
|
||||
(dismiss-connection-error false)
|
||||
(when pinned?
|
||||
(multiaccounts.update/multiaccount-update
|
||||
:pinned-mailservers (assoc pinned-mailservers
|
||||
|
@ -1161,6 +1170,7 @@
|
|||
(multiaccounts.update/multiaccount-update
|
||||
:pinned-mailservers (dissoc pinned-mailservers current-fleet)
|
||||
{})
|
||||
(dismiss-connection-error false)
|
||||
(change-mailserver))))
|
||||
|
||||
(fx/defn pin
|
||||
|
@ -1168,12 +1178,13 @@
|
|||
(let [current-fleet (node/current-fleet-key db)
|
||||
mailserver-id (:mailserver/current-id db)
|
||||
pinned-mailservers (get-in db [:multiaccount :pinned-mailservers])]
|
||||
(fx/merge cofx
|
||||
(multiaccounts.update/multiaccount-update
|
||||
cofx
|
||||
:pinned-mailservers (assoc pinned-mailservers
|
||||
current-fleet
|
||||
mailserver-id)
|
||||
{})))
|
||||
{})
|
||||
(dismiss-connection-error false))))
|
||||
|
||||
(fx/defn load-gaps-fx [{:keys [db] :as cofx} chat-id]
|
||||
(when-not (get-in db [:gaps-loaded? chat-id])
|
||||
|
|
Loading…
Reference in New Issue