[FIX 5813] connect to custom mailserver button fix
Signed-off-by: yenda <eric@status.im>
This commit is contained in:
parent
6438a1387b
commit
d5fcc0b003
|
@ -5,9 +5,12 @@
|
|||
(re-frame/reg-cofx
|
||||
:data-store/get-all-mailservers
|
||||
(fn [cofx _]
|
||||
(assoc cofx :data-store/mailservers (-> @core/account-realm
|
||||
(core/get-all :mailserver)
|
||||
(core/all-clj :mailserver)))))
|
||||
(assoc cofx :data-store/mailservers (mapv #(-> %
|
||||
(update :id keyword)
|
||||
(update :fleet keyword))
|
||||
(-> @core/account-realm
|
||||
(core/get-all :mailserver)
|
||||
(core/all-clj :mailserver))))))
|
||||
|
||||
(defn save-tx
|
||||
"Returns tx function for saving a mailserver"
|
||||
|
|
|
@ -264,6 +264,11 @@
|
|||
(fn [cofx [_ _ url]]
|
||||
(mailserver/set-url-from-qr url cofx)))
|
||||
|
||||
(handlers/register-handler-fx
|
||||
:mailserver.ui/connect-pressed
|
||||
(fn [cofx [_ mailserver-id]]
|
||||
(mailserver/show-connection-confirmation mailserver-id cofx)))
|
||||
|
||||
(handlers/register-handler-fx
|
||||
:mailserver.ui/connect-confirmed
|
||||
(fn [cofx [_ current-fleet mailserver-id]]
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
(defn- build [id mailserver-name address]
|
||||
(assoc (address->mailserver address)
|
||||
:id (keyword (string/replace id "-" ""))
|
||||
:id id
|
||||
:name mailserver-name))
|
||||
|
||||
(defn connected? [id {:keys [db]}]
|
||||
|
@ -136,7 +136,7 @@
|
|||
current-fleet (fleet/current-fleet db)
|
||||
mailserver (build
|
||||
(or (:value id)
|
||||
(string/replace (:random-id cofx) "-" ""))
|
||||
(keyword (string/replace (:random-id cofx) "-" "")))
|
||||
(:value name)
|
||||
(:value url))
|
||||
current (connected? (:id mailserver) cofx)]
|
||||
|
|
|
@ -232,7 +232,7 @@
|
|||
(is (= 1 (count (:data-store/tx actual)))))))
|
||||
(testing "existing mailserver"
|
||||
(let [cofx {:random-id "random-id"
|
||||
:db {:mailservers/manage {:id {:value "a"}
|
||||
:db {:mailservers/manage {:id {:value :a}
|
||||
:name {:value "new-name"}
|
||||
:url {:value "enode://new-id:new-password@url:port"}}
|
||||
|
||||
|
|
Loading…
Reference in New Issue