[FIX 5813] connect to custom mailserver button fix

Signed-off-by: yenda <eric@status.im>
This commit is contained in:
Eric Dvorsak 2018-09-18 10:13:35 +02:00 committed by yenda
parent 6438a1387b
commit d5fcc0b003
No known key found for this signature in database
GPG Key ID: 0095623C0069DCE6
4 changed files with 14 additions and 6 deletions

View File

@ -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"

View File

@ -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]]

View File

@ -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)]

View File

@ -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"}}